I am using python 2.7 on Linux Mint 16. I am facing an error, if I run my IDE (tried it on Spyder and Pycharm) from a program launcher (eg. from the prompt at Alt F2 or an icon
You are seeing different behaviour because your .bashrc
is always loaded before you launch PyCharm (or other editors) from the terminal. The other shortcuts know nothing of your .bashrc
and they should not. It seems that this module requires some very interesting configuration.
Your best bet to not have to use the terminal every time is to modify the shortcuts you're using (which is up to you to figure out) to set the proper environment variables. The most important of these variables is the LD_LIBRARY_PATH
.
export LD_LIBRARY_PATH="/opt/gurobi562/linux64/lib:/usr/local/lib/python2.7/dist- packages/gurobipy"
Warning: the dist- packages
seems odd but I've copied it out of your question. If it doesn't work, it's up to you to figure out what the right directory name is.
You don't set the path to the gurobipy.
Download then untar to /opt
.
cd to `/opt/gurobi562/linux64` and run `python setup.py install`
Add following to ~/.bashrc
.
export GUROBI_HOME="/opt/gurobi562/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"
From bash type source ~/.bashrc
start ipython shell and try from gurobipy import *
, it should work fine, the only error it will give is about not having a licence if you have not downloaded and installed one from here
To set system wide access, first create
sudo gedit /etc/ld.so.conf.d/gurobi_pi.conf
Then add
/opt/gurobi562/linux64/lib
and save the file.
Then enter
sudo ldconfig
to update the libs across the system. You should have access to the shared libs in Pycharm.