PIL, JPEG and Freetype support on Mac OS X Lion when using Virtualenv
Assuming you're using virtualenv and pip and working in your virutalenv ((your-env)username@computer:~$).
Download PIL, but do not install it:
$ pip install --no-install PIL
For Freetype support: edit setup.py in {your-virtualenv-folder}/build/PIL. On line 40 change FREETYPE_ROOT = None to FREETYPE_ROOT = libinclude('/usr/X11'):
# Library pointers. # # Use None to look for the libraries in well-known library locations. Theme: Basic Nature # Use a string to specify a single directory, for both the library and # the include files. Use a tuple to specify separate directories: # (libpath, includepath). Examples: # # JPEG_ROOT = "/home/libraries/jpeg-6b" # TIFF_ROOT = "/opt/tiff/lib", "/opt/tiff/include" # # If you have "lib" and "include" directories under a common parent, # you can use the "libinclude" helper: # # TIFF_ROOT = libinclude("/opt/tiff") TCL_ROOT = None JPEG_ROOT = None ZLIB_ROOT = None TIFF_ROOT = None FREETYPE_ROOT = libinclude('/usr/X11') LCMS_ROOT = None # FIXME: add mechanism to explicitly *disable* the use of a library # --------------------------------------------------------------------
Get libjpeg (choose any version, when I installed v9 was the latest):
$ curl -O http://www.ijg.org/files/jpegsrc.v9.tar.gz $ tar zxvf jpegsrc.v9.tar.gz $ cd jpeg-9/ $ ./configure $ make $ sudo make install
Install PIL:
$ pip install PIL
Done!