我在Linux Mint 16上使用python 2.7。如果我從程序啓動器運行我的IDE(在Spyder和Pycharm上嘗試它)(例如,從Alt F2的提示符中,我遇到了錯誤或者我的桌面上的圖標快捷方式)的模塊不加載和我碰到下面的錯誤Linux上的Python模塊錯誤
File "/usr/local/lib/python2.7/dist-packages/gurobipy/__init__.py", line 1, in from .gurobipy import * ImportError: libgurobi56.so: cannot open shared object file: No such file or directory
但是,如果我在命令行中正確運行的程序模塊負載和程序運行正常。我只有一個安裝每個IDE。來自兩個實例的輸出的sys.path如下:
sys.path中輸出Pycharm運行從快捷方式:
/home/XXXXXX/bin/pycharm-community-3.1.3/helpers/pydev', '/usr/local/lib/python2.7/dist-packages/pip-1.5.5-py2.7.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/home/XXXXXX/PycharmProjects/untitled8']:用於Pycharm
/home/XXXXXX/bin/pycharm-community-3.1.3/helpers/pydev', '/usr/local/lib/python2.7/dist-packages/pip-1.5.5-py2.7.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/home/XXXXXX/PycharmProjects/untitled8']
sys.path中oyutput運行命令行
封裝gurobipy是在/usr/lib/python2.7/dist-packages
安裝步驟遵循gurobi包:
1)未解壓下載到/ opt/gurobi562/LINUX64
2)添加下列行來的.bashrc
export GUROBI_HOME="/opt/gurobi562/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${GUROBI_HOME}/lib"
3)在/ opt/gurobi562/LINUX64跑蟒的setup.py安裝此創建gurobipy文件夾中/usr/local/lib/python2.7
4)增加了以下線的.bashrc
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib/python2.7/dist- packages/gurobipy"
您是否已將必要的行添加到.bashrc文件中? –
是的 export LD_LIBRARY_PATH =「$ {LD_LIBRARY_PATH}:/ usr/local/lib/python2.7/dist-packages/gurobipy」 – skr
你是如何安裝的? –