gpt4 book ai didi

python - 无法在 mac 10.10 上安装 or-tools

转载 作者:行者123 更新时间:2023-11-28 22:47:13 25 4
gpt4 key购买 nike

我正在尝试在 mac 10.10 上安装 Google 的 or-tools - https://code.google.com/p/or-tools/wiki/OrToolsWithPyPi .
我使用 python2.7 setup.py install --user 安装(也尝试使用 sudo 和不使用 --user)但是当它转到 pypi 下载包时得到以下信息:

.. Some other output ..
Installed /Users/Zach/Library/Python/2.7/lib/python/site-packages/ortools_examples-1.3549-py2.7.egg
Processing dependencies for ortools-examples==1.3549
Searching for ortools
Reading https://pypi.python.org/simple/ortools/
No local packages or download links found for ortools
error: Could not find suitable distribution for Requirement.parse('ortools')

我注意到它创建了目录 build/bdist.macosx-10.8-x86_64/egg 以便在其中构建所有内容,但我正在运行 macosx 10.10。在查找时 https://pypi.python.org/simple/ortools/我可以看到版本 3549 的匹配 egg 文件,但它适用于 macosx10.9,这可能是问题所在吗?为什么 setup.py 认为我使用的是 10.8?

无论如何,这可能不是问题所在,因此非常感谢任何其他帮助。谢谢!

最佳答案

以前的解决方案(使用easy_installegg文件)

我暂时解决了安装问题,直接从egg文件中使用easy-install安装or-tools(我用的是easy-install 从 MacPorts 安装)。这是我的安装方式。

sudo easy_install-2.7 https://pypi.python.org/packages/2.7/o/ortools/ortools-1.3853-py2.7-macosx-10.9-intel.egg#md5=f1f23b375652d40b9fbce682302e8dc8

这是我使用的or-tools egg文件的链接地址:https://pypi.python.org/pypi/ortools/1.3853

它会给出一些警告,但我可以使用 import ortools 在 Python 中加载 or-tools 没有问题。

新方案(使用pip)

我现在可以使用 pip 安装 ortools。但是,默认 protobuf 版本是 2.6.0,所以我必须卸载并重新安装适用于 ortools 的新 protobuf 版本(例如,在这种情况下,我们将使用 3.0.0b4) .

pip install protobuf==3.0.0b4
pip install ortools

请注意 ortools 仅兼容 Python 2.6、2.7 和 3.2 而不是 3.5

关于python - 无法在 mac 10.10 上安装 or-tools,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26593497/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com