如何在Mac OS X Snow Leopard上更新Numpy?

15
4个回答

32

sudo easy_install -U numpy

通过setuptools安装将会把新的numpy加入到sys.path中,用于非系统工具(我听说一些苹果工具依赖于系统自带的numpy)。通常情况下,在OS X上使用setuptools会“做正确的事情”。


1
正如Austin所指出的那样,您必须首先安装http://r.research.att.com/gfortran-4.2.3.dmg。在新的10.6.4安装中进行了测试。 - Mark
1
我在尝试运行sudo easy_install -U numpy时遇到了类似的问题,所以我执行了以下操作:sudo easy_install pip来安装pip。然后通过pip安装了numpy pip install numpy这个方法非常有效。 - A.Schulz

6
请使用pip install -U numpy代替,因为easy_install已被弃用,推荐使用pip

4

正如其他人建议的那样,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。


0
由于某些原因,easy_install -U numpy 无法正常工作。
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可能会起作用。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接