Since I recently got a new machine with a fresh install of OSX Lion, I thought I'd share my building-from-source experience. There seems to be a variety of approaches for doing this that folks have offered up - including installing another Python, installing homebrew (and subsequent pkgs), etc. So I thought I'd add one more - and for all I know this is redundant info.
My approach was the following:
- use the Python that came with the system:
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
- download matplotlib from git:
git clone git://github.com/matplotlib/matplotlib.git
export CFLAGS='-I/usr/X11/include/freetype2 -I/usr/X11/include/libpng15'
sudo ln -s /usr/X11/lib/libpng15.dylib libpng15.dylib
sudo ln -s /usr/X11/lib/libfreetype.6.dylib libfreetype.dylib
python setup.py build
sudo python setup.py install