【发布时间】:2011-12-28 09:32:55
【问题描述】:
这是我第一次设置 matplotlib。
我使用的是 OS X Lion 10.7(构建 11A511s,因此没有对 OS X Lion 的初始版本进行更新)。
我正在使用 virtualenv 和 pip 进行安装。
我知道与 libpng 1.5 不兼容,所以我不只是运行“pip install matplotlib”...而是...
我尝试从 virtualenv 内部运行它:
pip install -e git+https://github.com/matplotlib/matplotlib#egg=matplotlib-dev
看起来它开始安装,但随后出现此错误:
/Users/myusername/.virtualenvs/nltk/lib/python2.7/site-packages/numpy/core/include/numpy/
__multiarray_api.h:1532: warning: ‘int _import_array()’ defined but not used
lipo: can't open input file: /var/folders/wy/s1jr354d4xx7dk0lpdpbpsbc0000gn/T/
/ccfNUhyq.out (No such file or directory)
error: command 'llvm-gcc-4.2' failed with exit status 1
----------------------------------------
Command /Users/sameerfx/.virtualenvs/nltk/bin/python -c "import setuptools; __file__=
'/Users/sameerfx/.virtualenvs/nltk/src/matplotlib/setup.py'; exec(compile(open(__file__
).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps failed with error code 1
Storing complete log in /Users/sameerfx/.pip/pip.log
【问题讨论】:
-
更新:我已将 OS X 上传到 10.7.2(Build 11C74),但问题仍然存在。我也发到了 Matplotlin 的邮件列表,但还没有回复。
-
忘记使用 OS X Python 安装 matplotlib。可以做到,但非常痛苦。要么让自己获得一份 Enthought Python Distribution 的副本,要么从 python.org 获得一份 Python 2.7 的副本(或者使用 MacPorts,一切都很好)。然后安装 setuptools 和 pip 就可以了。
-
酷,谢谢钦梅。今晚我将在使用 MacPorts 安装最新的 Python 2.7 后重试。
-
我能够在 Mountain Lion 上使用您的方法安装 matplotlib。我正在使用 Homebrew 而不是 MacPorts 来管理事物。我遵循了
$brew doctor的建议,一旦警告得到解决,你的pip install -e git+https://github.com/matplotlib/matplotlib#egg=matplotlib-dev就起作用了。 -
Chinmay:你能把你的评论作为答案吗?我会投票赞成,我觉得它会被接受
标签: python matplotlib virtualenv pip