Install matplotlib is a nightmare

Building matplotlib on OSX has proved to be a nightmare because of the different types of zlib, png and freetype that may be on your system.

The recommended and supported way to build is to use a third-party
package manager to install the required dependencies, and then
install matplotlib from source using the setup.py script. Two widely
used package managers are homebrew and MacPorts. The following
example illustrates how to install libpng and freetype using
homebrew.

Example usage::

brew install libpng freetype

If you are using MacPorts, execute the following instead:

Example usage::

port install libpng freetype

To install matplotlib from source, execute:

Example usage::

  python setup.py install

结果freetype报错:

/usr/local/include/ft2build.h:56:10: fatal error: ‘freetype/config/ftheader.h’ file not found

google 之在stackoverflow
仍然不成功;

最后到处试试,终于在这篇博客看到;
http://blog.caoyuan.me/2012/08/matplotlib-error-mac-os-x/

最后终于成功!

Comments