简体   繁体   中英

Installing matplotlib on Mac OS X 10.9

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

$ sudo pip install 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

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

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

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?

It looks like you don't have the python library for objective-C installed. Did you double-check that you installed command line tools ? Then try port install py27-pyobjc

I recommend installing it via brew because I think it's better maintained, and it'll choose the best backend for you. I had a lot of issues installing matplotlib, but eventually was able to get them resolved.

Cheers, Olga

Specifically for mac: I had a similar issue in installing the matplotlib. Follow these instructions and you are done:

  1. Open terminal.

  2. Install python3 using brew. ( Ignore this step if you already have it) Note: To install brew:

     brew install python3
  3. Install freetype:

     brew install freetype
  4. Now install pkg-config using pip3:

     brew install pkg-config
  5. Finally install matplotlib:

     sudo pip3 install matplotlib

It's late but I hope this helps you.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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