简体   繁体   中英

How to use CPLEX with PYTHON on windows

Though I've already install Cplex, and could import cplex in Jupyter Notebook.

When I use "cplex.infinity", error arises and it says "module 'cplex' has no attribute 'infinity'"

I don't know the reason, hoping you could help me.

This is because virtual environments in Jupyter are different.If you don't tell your Jupiter kernel which environment it should use it won't use your environment from python terminal (even launching the jupyter notebook command with this virtual environment activated).

You can follow this guide .

Basically:

  1. You have to install your virtual environment for Jupyter
  2. You have to tell the kernel to use this environment in the top bar of your notebook

You will have then all the dependencies installed in your virtual environment available from Jupyter.

Cheers!

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