install matplotlib on mac

If it fails to install matplotlib on mac because the compiler cannot locate some freetype header files, and if you don’t have freetype, then first install it using brew for instance:

brew install freetype

Odds are the compiler still complains when you try the installation second time.

The reason is that many libraries are installed under /usr/X11 on mac, and they are not correctly located at compile time due to the non-canonical location. If you’re using pkg-config, an easy way to use them is to include the package database there in /usr/X11 when locating headers and libraries using pkg-config. Export the following variable before compiling matplotlib:

export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig


pip install matplotlib
install matplotlib on mac

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s