繁体   English   中英

在 Mac OS X 10.9 上安装 matplotlib

[英]Installing matplotlib on Mac OS X 10.9

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

$ sudo pip install matplotlib

但是在安装 OCRopus 之后,由于使用了这个模块,测试没有工作: matplotlib.backends._backend_gdk 阅读此文档和此问题使我确信,如果我通过以下方式重新安装matplotlib ,我的问题可能会消失:

$ sudo port install py27-matplotlib +gtk2

但是在 Mac OS X 10.9.1 上似乎有一个错误,我收到了这个错误: 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

$ 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

看起来你没有安装objective-C的python库。 您是否仔细检查过是否安装了命令行工具 然后尝试port install py27-pyobjc

我建议通过 brew 安装它,因为我认为它维护得更好,并且它会为你选择最好的后端。 我在安装 matplotlib 时遇到了很多问题,但最终能够解决它们。

干杯,奥尔加

专门针对 mac:我在安装 matplotlib 时遇到了类似的问题。 按照以下说明操作即可完成:

  1. 打开终端。

  2. 使用 brew 安装 python3。 (如果你已经有了这一步,请忽略) 注意:要安装 brew:

     brew install python3
  3. 安装自由类型:

     brew install freetype
  4. 现在使用 pip3 安装 pkg-config:

     brew install pkg-config
  5. 最后安装 matplotlib:

     sudo pip3 install matplotlib

已经晚了,但我希望这对您有所帮助。

结果发现问题出在我的电脑上。 我无法弄清楚问题的根源。 最后,我在干净安装的 Mac OS X 10.9.1 上使用新的 Xcode 命令行工具和新的 MacPorts 尝试了该过程,并升级了 python 2.7.6,然后它运行良好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM