[英]Cannot import correct version of numpy on OS X Mavericks
I have upgraded from Mountain Lion to Mavericks ande also updated Macports and its outdated packages. 我已经从Mountain Lion升级到Mavericks,并且还更新了Macports及其过时的软件包。 I have installed numpy 1.7, but the problem is the one used by python is still numpy 1.6. 我已经安装了numpy 1.7,但是问题是python使用的仍然是numpy 1.6。 The following are some information about my system. 以下是有关我的系统的一些信息。
>> python -c 'import numpy; print numpy.__version__'
>> python -c 'import numpy; print numpy.__version__'
gives >> python -c 'import numpy; print numpy.__version__'
给
1.6.2
which shows the active numpy version is 1.6.2 显示活动的numpy版本是1.6.2
>> port installed | grep numpy
>> port installed | grep numpy
gives >> port installed | grep numpy
给
py27-numpy @1.7.1_0 (active)
which shows the active numpy version is 1.7.1_0 显示活动的numpy版本是1.7.1_0
>> port installed | grep python
>> port installed | grep python
gives >> port installed | grep python
给
gnome-doc-utils @0.20.10_0+python27 (active)
gtk-doc @1.18_0+python27 (active)
ipython_select @0.3_1 (active)
opencv @2.4.6.1_2+python27 (active)
py27-ipython @0.13.2_0+notebook+parallel+scientific
py27-ipython @1.1.0_0+scientific
py27-ipython @1.1.0_0+notebook+parallel+scientific (active)
py27-wxpython-3.0 @2.9.5.0_0 (active)
py27-wxpython-devel @2.9.4.0_0
python24 @2.4.6_10 (active)
python27 @2.7.5_0
python27 @2.7.5_1 (active)
python_select @0.3_2
python_select @0.3_3 (active)
swig-python @2.0.9_0
swig-python @2.0.10_0 (active)
xorg-libxcb @1.9.1_0+python27 (active)
xorg-xcb-proto @1.8_0+python27 (active)
which shows, the active python version is python27. 如图所示,活动的python版本是python27。
Also, port select python
gives 另外, port select python
给
Available versions for python:
none
python24
python25-apple
python26-apple
python27
python27-apple (active)
You're using the apple-installed version of python, you can see this by the fact that 您使用的是苹果安装的python版本,可以通过以下事实看到这一点:
port select python
gives you 给你
python27-apple (active)
Remedy this with: 解决方法:
sudo port select python python27
If this: 如果这:
import sys
print sys.path
still shows that python is looking in /System/Library
instead of (or before) /opt/local/Library
for packages, then the apple versions of packages might be imported. 仍然显示python正在/System/Library
而不是(或之前)在/opt/local/Library
查找软件包,然后可能会导入Apple版本的软件包。 To solve this, you might be able to fix it by using a .pth
file with site
to modify your sys.path
. 要解决此问题,您可以通过在site
上使用.pth
文件来修改sys.path
来进行修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.