简体   繁体   中英

How can I install CPLEX for Python so I can access it via Jupyter?

I have already downloaded the CPLEX Studio. I am an absolute command prompt beginner, so following IBM's tutorials to install the API is proving to be very difficult. I want to get to the point where I can import cplex in Jupyter. I have reviewed other similar questions, but those answers are difficult to understand (for me). Is anyone able to explicitly explain how to do this in layman's terms?

If you can provide your OS, CPLEX version, python version and how you run jupyter, I can provide you the exact commands to run.

You basically want to have a command prompt setup with the same python interpreter you use for jupyter. Assuming CPLEX 12.10, you want to

$ cd $CPLEX_STUDIO_DIR1210/python/VERSION/PLATFORM
$ python setup.py install

(where VERSION is your python version, likely 3.6 or 3.7, PLATFORM is your OS platform)

For reference the doc is here: https://www.ibm.com/support/knowledgecenter/SSSA5P_12.10.0/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/set_up/Python_setup.html

You can do the installation from a jupyter notebook. Just create a new notebook, then:

If you are using the Community Edition, just create a cell with:

!pip install cplex

If you want to use an edition already downloaded on your disk, create a cell with:

%cd "C:\Program Files\IBM\ILOG\CPLEX_Studio1210\cplex\python\3.7\x64_win64"
!pip install .

You need to do this only once. After pip finishes, you just need to restart your jupyter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM