我正在尝试升级我的一些Python模块,特别是:matplotlib、scipy和numpy。在
我尝试过使用macports和easy-tu安装,但没有成功。我想他们安装的地方不对。。在
从macports我得到:
matty$ port installed
......... snip .........
py27-ipython @0.13.1_0+scientific (active)
py27-matplotlib @1.2.0_1+tkinter (active)
py27-numpy @1.6.2_1 (active)
python27 @2.7.3_1 (active)
从macports上看,我安装了matplotlib版本1.2和numpy版本1.6。但是,当我检查Python时,我得到:
^{pr2}$使用easy_install时,我遇到一些沙盒错误:
matty$ sudo easy_install -U numpy
......... snip .........
error: SandboxViolation: open('/dev/null', 'w') {}
我猜在某个地方有一个路径错误-这是一个猜测!任何帮助都是非常感谢的。在
编辑:
matty$ which python
/opt/local/bin/python
这是一个链接:
matty$ ls -l python
lrwxr-xr-x 1 root admin 24 27 Feb 13:34 python -> /opt/local/bin/python2.7
matty$ ls -l python2.7
lrwxr-xr-x 1 root admin 73 22 Oct 21:14 python2.7 ->
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
$Python路径:
matty$ echo $PYTHONPATH
/usr/local/scisoft/packages/python/lib/python2.6/site-packages/
完成此操作:
matty$ export PYTHONPATH=
matty$ python
>>> import numpy
>>> print numpy.__version__
1.6.2
>>> import matplotlib
>>> print matplotlib.__version__
1.2.0
似乎奏效了!在
将环境变量
$PYTHONPATH
设置为非标准位置(Macports Python安装目录之外)。在如果清除
$PYTHONPATH
,则测试将正常工作。在一旦您确认了这一点,就只需要找出})并将其删除。在
$PYTHONPATH
的设置位置(可能是~/.profile
、~/.bash_profile
或{相关问题 更多 >
编程相关推荐