There are several places online that discuss problems installing PIL on Mac OS X Snow Leopard
This is how I got it to work.
- Install lib jpeg using homebrew (which is super-aweseome!)
brew intall jpeg
.This installs the library into
/usr/local/Cellar/jpeg/7
-
Install libfreetype the old-fashioned way (./configure, make, sudo make install). I used freetype-2.1.10.pre-20050511.
-
Download, unpack PIL (I used Imaging-1.1.6). I had to make the following changes to setup.py
FREETYPE_ROOT = "/usr/local"
JPEG_ROOT = ("/usr/local/Cellar/jpeg/7/lib", "/usr/local/Cellar/jpeg/7/include")
- Then, build PIL:
python setup.py build_ext -i
- If the build works without any errors, you can run the tests:
python selftest.py
which should yield the following: 57 tests passed.
- (optional) I like to use virtualenv, so I activate that:
workon myproject
- Install PIL:
python setup.py install
At this point, code like the following works for me:
import Image
im = Image.open("/path/to/pretty/picture.jpg")
im.show()