scipy install on mountain lion failing

后端 未结 4 2119
醉话见心
醉话见心 2021-01-04 11:27

When I try to install scipy using pip install scipy it fails with the following traceback

Downloading/unpacking scipy
  Downloading scipy-0.10.1.tar.gz (6.2M         


        
4条回答
  •  醉酒成梦
    2021-01-04 12:27

    If you don't use virtualenv, then the least intrusive fix may be manually edit /usr/local/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/locations.py (Your pip version may vary). Just replace line 35 from:

    build_prefix = os.path.join(tempfile.gettempdir(), 'pip-build') 
    

    to:

    build_prefix = os.path.realpath(os.path.join(tempfile.gettempdir(), 'pip-build')) 
    

    After this change, you need to reinstall numpy (pip uninstall numpy; pip install numpy). The scipy can then be installed by pip correctly.

    The issue is caused by a pip bug. And the solution above is according to the pip patch (suggested in the issue discussion mentioned by Lokkju) from github user qwcode. This patch seems to have been merged to main pip repository. However, I don't see an easy way to brew update pip since it's bundled with Python. So just manually making this simple fix works for me.

提交回复
热议问题