OSX 10.9
使用pip install -U numpy
更新numpy后
用pip list | grep numpy
查看pip管理的numpy版本,显示为numpy (1.9.0)。
但在终端启动python执行
>>> import numpy
>>> print numpy.__version__
1.6.0
请问如何让python使用1.9.0的numpy?
Edit
1.系统存在多个版本的numpy,某些原因让python优先使用了1.6版本的numpy
2.numpy低版本问题让import pandas 报错
解决方法:
>>> import numpy
>>> print numpy.__version__
1.6.0
>>> print(numpy)
<module 'numpy' from '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/__init__.pyc'>
去目标文件夹删除该numpy文件,再次启动python
numpy的版本就是最新的1.9
>>> import numpy
>>> print numpy.__version__
1.9.0
>>> print(numpy)
<module 'numpy' from '/Library/Python/2.7/site-packages/numpy/__init__.pyc'>
Install a virtualenv, so that multiple versions of the library can exist at the same time.
pyenv[https://github.com/yyuu/pyenv]
Use conda in Anaconda to manage multiple environments
For reference:
http://conda.pydata.org/docs/using/envs.html#create-a-separate-environment