使用旧版本numpy的,甚至有一个较新的版本中安装
问题描述:
我已经使用的easy_install安装numpy的安装numpy的1.7.1,但是当我在Python检查我的版本:使用旧版本numpy的,甚至有一个较新的版本中安装
python -c "import numpy; print numpy.version.version"
它说1.6.2
我在做什么错了?
答
很可能,您已经从debian存储库安装了numpy,或者使用其他参数安装了pip安装。使用
python -c 'import os,numpy;print(numpy.__file__)'
找出流氓numpy版本在哪里。虽然您可以删除此目录,但您也可以向包管理器询问该文件所属的包。同样,在Debian系统上:
$ python -c 'import numpy;print(numpy.__file__)'
/usr/lib/pymodules/python2.7/numpy/__init__.pyc
$ readlink -f /usr/lib/pymodules/python2.7/numpy/__init__.py
/usr/share/pyshared/numpy/__init__.py
$ dpkg -S /usr/share/pyshared/numpy/__init__.py
python-numpy: /usr/share/pyshared/numpy/__init__.py
$ sudo apt-get remove python-numpy
+0
使用numpy .__文件_帮助我追踪了numpy安装的位置,并且我能够自己完成剩下的工作。谢谢! – jlonganecker 2013-05-11 18:30:17
答
须藤的easy_install -U numpy的
...多次尝试后,上面的代码为我工作,终于来了!
如果你想使用特定的版本,我建议你使用[virtualenv](http://stackoverflow.com/questions/5844869/comprehensive-beginners-virtualenv-tutorial)。 – Yohann 2013-05-06 03:04:43