在Mac OS X 10.9上安装matplotlib

在Mac OS X 10.9上安装matplotlib

问题描述:

作为安装 OCRopus 的要求,我已经在Mac上成功安装了matplotlib pip的OS X 10.9.1:

As a requirement to install OCRopus, I have successfully installed matplotlib on Mac OS X 10.9.1 by pip:

$ sudo pip install matplotlib

但是在安装OCRopus之后,由于延迟了以下模块,该测试无法正常工作:matplotlib.backends._backend_gdk.阅读此文档和此问题使我确信,如果我通过以下方式重新安装matplotlib,我的问题可能就不会解决:>

But after installing OCRopus the test didn't work because of laking this module: matplotlib.backends._backend_gdk. Reading this document and this question convinced me that my problems might gone if I reinstall matplotlib through:

$ sudo port install py27-matplotlib +gtk2

但是在Mac OS X 10.9.1上,似乎有一个错误,我收到此错误:Error: Dependency 'py27-pyobjc' not found.:

But on Mac OS X 10.9.1 it seems there is a bug which I receive this error: Error: Dependency 'py27-pyobjc' not found.:

--->  Computing dependencies for py27-matplotlib
Error: Dependency 'py27-pyobjc' not found.
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port py27-matplotlib failed

我所需要做的就是安装matplotlib的其他变体.这就是我从port variants py27-matplotlib那里得到的:

All I need is to install different variant of matplotlib. This is what I get from port variants py27-matplotlib:

$ port variants py27-matplotlib
py27-matplotlib has the variants:
   cairo: Enable Cairo backends
   dvipng: Enable dvipng support
   ghostscript: Enable GhostScript support
   gtk2: Enable GTKAgg backend
   gtk3: Enable GTK3Agg backend
   latex: Enable LaTeX support
   pdftops: Enable pdftops support
   pyside: Enable PySide backend
   qt4: Enable QT4Agg backend
[+]tkinter: Enable tkAgg backend
   universal: Build for multiple architectures
   webagg: Enable WebAgg backend

有人知道如何在Mac OS X 10.9.1上获取+gtk2吗?或如何使用此特定设置使pip安装matplotlib?

Any idea how to get +gtk2 on Mac OS X 10.9.1? or how to make pip to install matplotlib with this particular settings?

事实证明问题出在我的计算机上.我不知道问题的根源.最后,我在干净安装的Mac OS X 10.9.1上使用新的Xcode命令行工具和新的MacPorts尝试了该过程,并升级了python 2.7.6,然后运行良好.

It turns out problem was on my computer. I couldn't figure out the source of the problem. Finally, I tried out the process on a clean installed Mac OS X 10.9.1 with new Xcode command-line tools, and new MacPorts, and upgraded python 2.7.6, then it worked fine.