Build PIL on a custom Python2.6 on recent Ubuntu

If you need PIL in your custom Python 2.6 build (your build needs to be custom if you want to target LTS Ubuntu Server's default Python while working on a more recent Ubuntu), you will likely find your PIL build doesn't work (because, of course, you have a 64-bit build of Ubuntu and the libraries are in a different place...). To fix it, here's the patch:

***    2009-11-15 11:06:10.000000000 -0500
--- 2012-03-09 17:19:38.000000000 -0500
*** 148,153 ****
--- 148,154 ----
add_directory(include_dirs, "/opt/local/include")

add_directory(library_dirs, "/usr/local/lib")
+ add_directory(library_dirs, "/usr/lib/x86_64-linux-gnu")
# FIXME: check /opt/stuff directories here?

prefix = sysconfig.get_config_var("prefix")

After that, 1.1.7 builds with the standard "python2.6 install" (with the build requirements installed).

But what *I* wound up doing, (once I'd fixed it, and written this blog post) was remember that Pillow exists... and just did pip install pillow instead.


  1. Alex Clark

    Alex Clark on 03/11/2012 12:07 a.m. #

    Pillow (PIL fork) should support this already. If not, please open a ticket:


  2. Mike Fletcher

    Mike Fletcher on 03/12/2012 7:44 a.m. #

    Um, note the last line of the post... :)

Comments are closed.


Pingbacks are closed.