2012-10-15 110 views
5

我試圖更新/升級我的NumPy,但是失敗。我想我可能在不同目錄下安裝了NumPy的多個版本,但默認情況下python會導入一箇舊版本。任何幫助?NumPy將不會從OS X上的1.5.1升級到1.6.2 10.7

這裏就是我的Python是:

Gonzo-vs-Kitties:~ brian$ which python 
/Library/Frameworks/Python.framework/Versions/2.7/bin/python 

下面是Python的進口版本:

Gonzo-vs-Kitties:~ brian$ python 
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import numpy 
>>> print numpy.__version__ 
1.5.1 
>>> 

現在我用的easy_install升級NumPy的:即使在我升級

Gonzo-vs-Kitties:~ brian$ sudo easy_install --upgrade numpy 
Searching for numpy 
Reading http://pypi.python.org/simple/numpy/ 
Reading http://numpy.scipy.org 
Reading http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103 
Reading http://numeric.scipy.org 
Best match: numpy 1.6.2 
Processing numpy-1.6.2-py2.7-macosx-10.7-intel.egg 
numpy 1.6.2 is already the active version in easy-install.pth 
Installing f2py script to /usr/local/bin 

Using /Library/Python/2.7/site-packages/numpy-1.6.2-py2.7-macosx-10.7-intel.egg 
Processing dependencies for numpy 
Finished processing dependencies for numpy 

,NumPy仍舊是舊版本:

>>> import numpy 
>>> print numpy.__version__ 
1.5.1 
>>> 

這是我的sys.path:

>>> print sys.path 
['', '/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg', '/Library/Python/2.7/site-packages/virtualenv-1.8.2-py2.7.egg', '/Users/brian/Code/trac/genshi-trunk', '/Users/brian/Code/trac/trac-trunk', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg', '/Library/Python/2.7/site-packages/numpy-1.6.2-py2.7-macosx-10.7-intel.egg', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages'] 

任何想法?

+0

通常對於這樣的事情,virtualenv是驚人的。您可以創建一個新的Venv並安裝任何新版本,而不用擔心正常導入的東西,衝突等。如果出現任何問題,則更容易排除故障。 – miki725

回答

4

檢查您numpy的軟件包的路徑:

import numpy 
print numpy.__path__ 

並檢查它是否是你剛剛安裝的一個。

+0

這不是我剛剛安裝的那個。 __path__屬性指向'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy' 關於如何解決這個問題的想法? – BMS

+0

刪除舊版本的numpy或升級它 – waitingkuo

+1

當我使用pip和/或easy_install進行安裝時,它會刪除我的新版本1.6.2 NumPy並完全忽略1.5.1 NumPy。如何卸載卸載程序無法看到的版本? – BMS