Django and Python Imaging Library (PIL) on Leopard

— Paul Annesley, November 2007

Chapter 5 of the excellent Django Book makes use of django.db.models.URLField().

When running under the default Python 2.5 environment shipped with Mac OS 10.5 Leopard, this causes an error something along these lines:

$ ./ validate
Error: One or more models did not validate: "headshot": To use ImageFields, you need to install the Python Imaging Library. Get it at .

Assuming you’ve installed XCode (go on, you know you want to..) this can be solved like so:

Install libjpeg

tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
sudo make install-lib

Install Python Imaging Library (PIL)

tar zxvf Imaging-1.1.6.tar.gz 
cd Imaging-1.1.6
sudo python install

Not too hard, but still, sucks to be us Apple users sometimes. If my Ubuntu Server virtual machine didn’t make my laptop run so damn hot, I’d be using that. Are tickless kernels and PowerTOP helping anyone on this front yet?

If it all looks too hard, I’m sure MacPorts (or is it DarwinPorts? who knows) will hold your hand.

← index