python matplotlib framework under macosx?

Optionally you could use the Agg backend which requires no extra installation of anything. Just put backend : Agg into ~/.matplotlib/matplotlibrc


Some users may not want to change the backend for all of their scripts. This page -- http://matplotlib.org/faq/usage_faq.html#what-is-a-backend -- tells another way:

import matplotlib
matplotlib.use('TkAgg')

You have to do this before importing a subpackage of matplotlib or a third-party package that depends on matplotlib.


There are two ways Python can be built and installed on Mac OS X. One is as a traditional flat Unix-y shared library. The other is known as a framework install, a file layout similar to other frameworks on OS X where all of the component directories (include, lib, bin) for the product are installed as subdirectories under the main framework directory. The Fink project installs Pythons using the Unix shared library method. Most other distributors, including the Apple-supplied Pythons in OS X, the python.org installers, and the MacPorts project, install framework versions of Python. One of the advantages of a framework installation is that it will work properly with various OS X API calls that require a window manager connection (generally GUI-related interfaces) because the Python interpreter is packaged as an app bundle within the framework.

If you do need the functions in matplotlib that require the GUI functions, the simplest approach may be to switch to MacPorts which also packages matplotlib (port py27-matplotlib) and its dependencies. If so, be careful not to mix packages between Fink and MacPorts. It's best to stick with one or the other unless you are really careful. Adjust your shell path accordingly; it would be safest to remove all of the Fink packages and install MacPorts versions.