If you run multiple versions of CPLEX side-by-side, then use this way
of declaring the location of CPLEX and its Python API to your Python
installation by means of the environment variable PYTHONPATH.
To start using the CPLEX Python API, set the Python path environment
variable PYTHONPATH to the value of
yourCplexhome/python/VERSION/PLATFORM. Setting this environment
variable enables that version of Python to find the CPLEX modules that
it needs to run Python commands and scripts that use the CPLEX Python
API.
正如另一个答案中建议的那样,您可以使用
PYTHONPATH
环境变量。另一种选择是在免费“社区版”的顶部安装学术版的cplex
包。这对您的系统Python或virtualenv都是有效的。例如,可以执行以下操作:对于第一个命令,},而{}是{}。完成此操作后,不应再获得CPXERR_RESTRICTED_VERSION。在
COSDIR
是安装CPLEX Optimization Studio的位置,platform
类似于x86-64_linux
,x64_win64
,x86-64_osx
等等。在上面的示例中,您可以看到COSDIR
是{https://www.ibm.com/support/knowledgecenter/SSSA5P_12.7.0/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/set_up/Python_setup.html
您可以转到安装CPLEX的方向。例如,D:\Cplex 之后,您将看到一个文件夹名cplex,然后单击该文件夹,>;python>;选择python的版本(例如:3.6),然后选择文件夹x64\u win64,您将看到另一个文件名cplex。 将此文件复制到python站点包^^中,就不会受到限制
相关问题 更多 >
编程相关推荐