image of a code editor

Libjpeg and Python Imaging (PIL) on Snow Leopard

This post was early in my Python career, I now work at the best software development company in Sydney.

Installing Python Imaging (PIL) with Jpeg support on Snow Leopard isn’t obvious. For anyone struggling with it, here’s a solution:

1. Download the source from http://libjpeg.sourceforge.net/

2. Extract, configure, make:

tar zxvf jpegsrc.v6b.tar.gz cd jpeg-6b cp /usr/share/libtool/config/config.sub . cp /usr/share/libtool/config/config.guess . ./configure --enable-shared --enable-static make

3. You may need to create the following directories:

sudo mkdir -p /usr/local/include sudo mkdir -p /usr/local/lib sudo mkdir -p /usr/local/man/man1

4. Now you can install it as usual.

sudo make install

5. If you want to freetype support, do that now.

6. Finally, you can install PIL. Be sure to activate any virtualenv now if you don’t want to install PIL into the system site-packages.

pip install http://effbot.org/downloads/Imaging-1.1.6.tar.gz

At least the native Python 2.6 on Snow Leopard works great, and this wasn’t nearly as painful as installing PIL on Cygwin!