如何升级Numpy到最新版本?我需要从这里下载.dmg文件吗:http://sourceforge.net/projects/numpy/files/ ?这个.dmg文件只适用于10.5系统吗? 我按照以下说明安装了numpy:http://www.scipy.org/Installing_SciPy/Mac_OS_X。 我当前的Numpy版本是1.2.1。我正在运行Mac OS X 10.6.1 Snow Leopard。谢谢!
sudo easy_install -U numpy
通过setuptools安装将会把新的numpy加入到sys.path中,用于非系统工具(我听说一些苹果工具依赖于系统自带的numpy)。通常情况下,在OS X上使用setuptools会“做正确的事情”。
pip install -U numpy
代替,因为easy_install已被弃用,推荐使用pip
。正如其他人建议的那样,MacPorts 可以在多种架构和版本的 MacOsX 上运行,并允许更新等功能:
$ port search numpy
py-numpy @1.3.0 (python)
The core utilities for the scientific library scipy for Python
py25-numpy @1.3.0 (python)
The core utilities for the scientific library scipy for Python
py25-symeig @1.4 (python, science)
Symeig - Symmetrical eigenvalue routines for NumPy.
py26-numpy @1.3.0 (python)
The core utilities for the scientific library scipy for Python
py26-scikits-audiolab @0.10.2 (python, science, audio)
Audiolab is a python toolbox to read/write audio files from numpy arrays
Found 5 ports.
$
在您的情况下,只需执行以下操作:
$ sudo port install py26-numpy
如果你想要/需要自己编译,可以参照HJBlog中的说明进行操作。我已经测试过并成功编译了64位版本的Matplotlib。
print numpy.__version__
始终返回1.2.1
因此,我首先通过找到并删除整个文件夹来删除numpy 1.2.1:
import numpy
print numpy.__file__
我从以下网址下载了GNU Fortran编译器:
http://r.research.att.com/gfortran-4.2.3.dmg
我使用easy_install安装了numpy。
回想起来,如果我安装了Fortran编译器,那么easy_install -U numpy可能会起作用。
sudo easy_install -U numpy
时遇到了类似的问题,所以我执行了以下操作:sudo easy_install pip
来安装pip。然后通过pip
安装了numpypip install numpy
这个方法非常有效。 - A.Schulz