-->

can't install or-tools on mac 10.10

2019-07-22 01:23发布

问题:

I'm trying to install Google's or-tools on mac 10.10 - https://code.google.com/p/or-tools/wiki/OrToolsWithPyPi .
I install using python2.7 setup.py install --user (tried also with sudo and without --user) but get the following when it goes to pypi to download the package:

.. 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')

I noticed that it creates the directory build/bdist.macosx-10.8-x86_64/egg in order to build everything in but I'm running macosx 10.10. When looking in https://pypi.python.org/simple/ortools/ I can see a matching egg file for version 3549 but it's for macosx10.9, could that be the problem? Why does setup.py thinks I'm on 10.8?

Anyway, it might not be the problem, so any other help is very appreciated. Thanks!

回答1:

Former solution (using easy_install and egg file)

I temporarily solve the problem of installing by installing or-tools using easy-install directly from the egg file (I use easy-install installed from MacPorts). Here is how I install it.

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

Here is the link address for or-tools egg file that I use: https://pypi.python.org/pypi/ortools/1.3853

It will give some warning but I can load or-tools in Python by using import ortools with no problem.

New solution (using pip)

I can now install ortools using pip. However, default protobuf version is 2.6.0 so I have to uninstall and reinstall new protobuf version that works with ortools (e.g. in this case, we will do 3.0.0b4).

pip install protobuf==3.0.0b4
pip install ortools

Note that ortools is only compatible with Python 2.6, 2.7, and 3.2 not 3.5 yet



回答2:

Now or-tools support python 3.5 and python 3.6. also please notice v6.6 will require protobuf 3.5

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