在 Mac 上使用 Python 设置 CPLEX

Setting up CPLEX with Python on Mac

我正在尝试在 Mac 上的 Python 上安装 cplex,但我真的卡住了。

setup.py 文件位于以下路径中:

/Users/mac/Applications/IBM/ILOG/CPLEX_Studio127/cplex/python/2.7/x86-64_osx

我正在为 运行 Python 使用 canopy。

我在Mac的Terminal输入如下代码,结果如下:

macs-mbp:~ mac$ python setup.py install
/Users/mac/Library/Enthought/Canopy_64bit/User/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory
macs-mbp:~ mac$ 

然后我决定使用 (option --home) 但结果也很糟糕:

macs-mbp:~ mac$ python setup.py install --home /Users/mac/Applications/IBM/ILOG/CPLEX_Studio127/cplex

/Users/mac/Library/Enthought/Canopy_64bit/User/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory
macs-mbp:~ mac$ 

我也尝试使用 cd,但没有产生任何改进。

对于在 Mac 上的 Python 上安装 cplex,我们将不胜感激!

这看起来可能类似于 this SO 问题。

如果您执行以下操作会发生什么:

cd /Users/mac/Applications/IBM/ILOG/CPLEX_Studio127/cplex/python/2.7/x86-64_osx
python setup.py install

此外,您必须确保上面的 "python" 指向您想要的 python(树冠与系统 python)。