[英]model.solve() method is not working (“CPLEX DLL not found”) for DOcplex for Python
I build my mathematical model using DOcplex IBM package for Python. 我使用适用于Python的DOcplex IBM软件包构建了数学模型。 I am sure that the other part of the modeling is correct, however when the call to
Model.solve()
is executed, and I get the following error: 我确定建模的其他部分是正确的,但是当执行对
Model.solve()
的调用时, Model.solve()
以下错误:
"CPLEX DLL not found: please provide DOcplexcloud credentials"
I have CPLEX Studio 12.6 installed on my pc, and I want to solve the problem locally not on cloud. 我的PC上安装了CPLEX Studio 12.6,我想在本地而不是在云上解决问题。
It sounds like you do not have the CPLEX Python API "installed". 听起来您没有“安装” CPLEX Python API。 By default, when you install CPLEX Optimization Studio (aka COS) the Python bindings are copied onto your disk, but they aren't associated with any of your local Python installations.
默认情况下,当您安装CPLEX Optimization Studio(aka COS)时,Python绑定被复制到磁盘上,但是它们与您的任何本地Python安装都不相关。
If you follow the instructions on the Setting up the Python API of CPLEX page, you should be able to do a local solve. 如果按照“ 设置CPLEX的Python API”页面上的说明进行操作,则应该能够进行本地求解。 In short, you can either run the
setup.py
script under yourCPLEXhome/python/VERSION/PLATFORM
, or you can set the PYTHONPATH
environment variable. 简而言之,您可以在
yourCPLEXhome/python/VERSION/PLATFORM
下运行setup.py
脚本,也可以设置PYTHONPATH
环境变量。
Are you using Anaconda? 您正在使用Anaconda吗? I solved it by running the following in the CPLEX install directory:
我通过在CPLEX安装目录中运行以下命令解决了该问题:
python setup.py install --home <PackagesHome>\cplex
with <PackagesHome>
as <user>\\AppData\\Local\\Continuum\\Anaconda2\\Lib\\site-packages
使用
<PackagesHome>
作为<user>\\AppData\\Local\\Continuum\\Anaconda2\\Lib\\site-packages
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.