python不使用更新的pip scipy包 [英] python doesn't use updated pip scipy package
问题描述
我目前正在使用scipy
,并且在更新它时遇到问题.
它是通过pip安装的,pip list
给了我:
I'm currently working with scipy
and having problems updating it.
It is installed via pip and pip list
gives me:
...
scipy (0.13.2)
...
但是当我启动python并执行以下操作时:
But when I fire up my python and do:
import scipy
print scipy.__version__
我得到:
0.11.0
有人知道哪里出了什么问题吗?也许这条路?我当时以为python首先安装scipy时会使用我的pip包.
Any idea where if got something wrong? Maybe the path? I was thinking python uses my pip packages as I installed scipy with it in the first place.
其他信息:
which python
在终端中的输出:
Additional Information:
Output of which python
in terminal:
/usr/bin/python
print sys.path
的输出:
'/Users/*MY_USER*/Documents/workspace/*MY_PROJECT*',
'/Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg',
'/Users/*MY_USER*/Documents/workspace/*MY_PROJECT*',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
'/Library/Python/2.7/site-packages', 'lib'
打印输出scipy.__path__
:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy
which pip
的输出:
/usr/local/bin/pip
更新:
看来,scipy的另一个版本是从
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/
因为它出现在正确的/Library/Python/2.7/site-packages
UPDATE:
It seems, another version of scipy is pulled first from
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/
because it appears before the correct /Library/Python/2.7/site-packages
所以,如果我跑步
sys.path.insert(1, "/Library/Python/2.7/site-packages")
正确版本的scipy已加载!
So if i run
sys.path.insert(1, "/Library/Python/2.7/site-packages")
the correct version of scipy is loaded!
那么,如何才能永久,彻底地解决此订购问题?平台OSX小牛.
So how can i fix this ordering issue clean and permanently? Platform OSX Mavericks.
推荐答案
您可以简单地删除(或重命名)旧库的目录,或从更新的软件包中创建符号链接.我首先重命名,检查是否一切正常,然后将其删除.
You can simply delete (or rename) the directories of old libraries or create symbolic links from updated packages. I firstly renamed, checked if everything works, then I deleted them.
就我而言,pip正在安装/更新/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages中的库,因此此目录始终具有更新的版本.但是,我的python主要查看/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python,其中包含scipy,numpy和matplotlib的旧版本.当我删除旧版本时,新的python开始加载更新的模块.
In my case, pip is installing/updating the libraries in /Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages, so this directory always has the updated versions. However, my python primarily looks at /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python, where old version of scipy, numpy and matplotlib resides. When I deleted old versions, new python started loading updated modules.
这篇关于python不使用更新的pip scipy包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!