【问题标题】:can't install or-tools on mac 10.10无法在 mac 10.10 上安装 or-tools
【发布时间】:2014-12-22 23:34:03
【问题描述】:

我正在尝试在 mac 10.10 - https://code.google.com/p/or-tools/wiki/OrToolsWithPyPi 上安装 Google 的 or-tools。
我使用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 上?

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

【问题讨论】:

    标签: python macos osx-yosemite pypi or-tools


    【解决方案1】:

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

    我通过直接从egg文件中使用easy-install安装or-tools来临时解决安装问题(我使用从MacPorts安装的easy-install)。这是我的安装方法。

    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

    【讨论】:

    • 我在 10.10 也遇到了这个问题。尝试了这个答案但得到了一个错误:No local packages or download links found for ortools==1.3853。有什么想法吗?
    • 嗨乔。是的,我的解决方案现在已经过时了,因为他们没有在他们的网站上更新 ortools 包(我遇到了同样的问题)。我不确定最新的或工具在哪里。如果我找到解决方案,我会尽快回复您。
    • 我安装了它,但老实说我不知道​​怎么安装!如果我可以重新创建它,我会告诉你。有一个更新的 OR Tools egg。另请查看this discussion,这可能会有所帮助。
    • @joeh 我更新了解决方案。现在,我可以使用pip 来安装ortools。您可以从这个存储库尝试代码 sn-p:github.com/daniel-acuna/reviewer_assignment/blob/master/…
    【解决方案2】:

    现在 or-tools 支持 python 3.5 和 python 3.6。 另请注意 v6.6 将需要 protobuf 3.5

    cf 要求https://github.com/google/or-tools/blob/master/Dependencies.txt

    【讨论】:

      猜你喜欢
      • 2021-12-18
      • 2015-08-27
      • 1970-01-01
      • 1970-01-01
      • 2015-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多