我在Linux Mint 16上使用Python2.7。我遇到了一个错误,如果我从程序启动程序(例如,从Alt F2的提示符或桌面上的图标快捷方式)运行IDE(在Spyder和Pycharm上尝试过),则模块不会加载,并且会出现以下错误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只有一个安装。这个系统路径两个实例的输出如下:
在系统路径从快捷方式运行Pycharm的输出:
^{pr2}$
在系统路径从命令行运行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']
包gurobiby位于/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中运行python设置.py安装这个在/usr/local/lib/python2.7中创建的gurobiby文件夹
4)将以下行添加到.bashrcexport LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib/python2.7/dist- packages/gurobipy"