cplex 12.9, jupyter notebook , python 3.7.X 运行 Cplex 例子,出现错误时如何设置cplex python jupyter notebook 例子运行

我原来用anaconda 安装的python 3.8.3 , 发现cplex12.9仅支持python 2.7, 3.6. 3.7. 只能把python 版本降回3。7

方法, conda install python=3.7  等了足有10多分钟,才开始降版本。并成功。

1。如何设置好python运行库。可以看IBM的文档, https://www.ibm.com/support/knowledgecenter/zh/SSSA5P_12.9.0/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/set_up/Python_setup.html

如何不想看文档, 我分享下我用的方法。 红框中的是cplex安装后带的python3.7设置所需要的文件, 运行红圈里的命令, 就可以了。 

cplex 12.9, jupyter notebook , python 3.7.X 运行 Cplex 例子,出现错误时如何设置cplex python jupyter notebook 例子运行

2。 结束后, 退回到下面的目录(为了让notebook找到例子所在目录), 就可以在这个窗口下运行, jupyter notebook 了。 

cplex 12.9, jupyter notebook , python 3.7.X 运行 Cplex 例子,出现错误时如何设置cplex python jupyter notebook 例子运行

3。选比较简单的, pasta_production.ipynb, 比较简单的一个例子。 cell-run all,看一下运行结果:正确!!

cplex 12.9, jupyter notebook , python 3.7.X 运行 Cplex 例子,出现错误时如何设置cplex python jupyter notebook 例子运行