简体   繁体   English

Python路径:为什么看不到numpy的最新版本

[英]Python path: why can't pip see latest version of numpy

Working inside a virtualenv, I'm trying to install scikit-image, but it fails, telling me that I need a newer (or any) version of numpy. 我在virtualenv内部工作,试图安装scikit-image,但失败了,并告诉我我需要较新(或任何版本)的numpy。

$ sudo pip install -U scikit-image
...
ImportError: You need `numpy` version 1.6 or later.
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /Users/aps/Dropbox/experiments/build/scikit-image

I don't understand this, because from Python, numpy 1.7 is already on my path. 我不明白这一点,因为从Python开始,numpy 1.7已经存在。

$ python 
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__version__
'1.7.1'

What is going on - why can't the system installing scikit-image see the newest version of numpy? 发生了什么-为什么安装scikit-image的系统看不到最新版本的numpy? And how can I fix this? 我该如何解决呢?

The path to numpy already seems to be in my ~/.bash_profile : numpy的路径似乎已经在我的~/.bash_profile

>>> numpy.__path__
['/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy']
>>> exit()
$ vi ~/.bash_profile
...
export PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages:$PYTHONPATH

UPDATE: 更新:

numpy version 1.7 is also in the su path: numpy版本1.7也位于su路径中:

$ sudo python 
Password:
Python 2.7.5 (default, Aug  1 2013, 00:59:40) 
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__version__
'1.7.1'

You need to make sure that all those packages are available within the virtualenv itself. 您需要确保所有这些软件包在virtualenv本身中都可用。 Did you try running pip freeze after sourcing bin/activate ? 您是否在采购bin/activate后尝试运行pip freeze Using the virtualenv package, the only library that comes "preinstalled" by default is distribute , and all other dependencies must be manually added. 使用virtualenv软件包,默认情况下唯一“预安装”的库是distribute ,并且必须手动添加所有其他依赖项。 With venv (built into py3k) all of your system libraries should be available directly. 使用venv (内置在py3k中),您的所有系统库都应该直接可用。 Which are you using? 您正在使用哪个?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM