search




subscribe

Email new articles to:





context

Search my entire digital life. Lijit Search

shared links

My recommended reading list.


community

Install libjpeg and PIL on OS X Leopard

You will need these if you're working with ImageFields in Django.


I have been building my first site using the Python-based development framework Django and it is really fantastic! I am picking up some of it very fast (the concept of templates and template tags, for example) because of my experience with the PHP-based CMS ExpressionEngine, and some of it is totally foreign to me... but as I muddle through it, I can tell that I've begun to learn some very powerful tools, especially once I got Django working with the jQuery javascript library.

When working with images such as profile avatars, you need to have the Python Imaging Library installed, which also means installing the libjpeg library to compile PIL. I found a couple articles here and here but it seemed that only part of each worked for me. Last night I installed everything again on my PowerBook running Mac OS X Leopard 10.5.4, so I recorded the combination that worked for me:

1. If you haven't already, you must install the Apple Development Tools (XCode).
2. Download and install the Unix software installer Fink. The binary installers for the Mac worked great, both on my Intel and PowerPC machines.
3. Open a Terminal window and type:
fink install libjpeg
curl -O http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz
tar -xzf Imaging-1.1.6.tar.gz
cd Imaging-1.1.6
sudo python setup.py install
And that's it! cool smile

Technorati Tags: , , , , , , , , , ,

Wednesday, July 09, 2008
• (0) TrackbacksPermalink

Reader Comments:

Thank you so much for this. I spent over 2 hours trying to get these two to install on my mac to no avail but your instructions worked flawlessly smile

G


Posted by GP  on  12/29  at  06:04 AM

Hi There,
If you do not use “fink” for whatever reason,  and use “maport” instead, then do the following:
  port install gd2

The gd2 would install a number of the graphics lib, including libjpeg and libpng.  you will find them in /opt/local/lib


Posted by Fawzi  on  12/31  at  03:53 PM

Hi Colby, Thanks again for these instructions.  Worked great on my Intel macs and then finally, finally, on my PPC.  The trick was that even though it didn’t work before, complete removal of the previous install attempt as well as the uncompressed Imaging-1.1.6 folder is needed. Also, before installing PIL, I edited the JPEG_ROOT in setup.py to equal “/sw/lib” where the libjped had been put by fink.


Posted by tej  on  04/10  at  05:05 PM

Oh man! thanks so much for posting this. I was about to tear my hair out. FYI, I’ve tested these exact instructions with 10.6 (snow leopard) and they work flawlessly there as well.

I was trying to manually install libjpeg, then manually install Imaging-1.1.6 ... apparently fink knows something about OS X’s library paths that configure doesn’t…


Posted by James  on  09/13  at  07:58 PM

I had to set

JPEG_ROOT = ”/sw/lib/libjpeg.dylib”

in the setup.py file.

http://kylefox.ca/blog/2009/jan/11/how-install-pil-libjpeg-mac-os-x-105/


Posted by Thorarinn  on  10/16  at  09:44 AM

I was trying to manually install libjpeg, then manually install Imaging-1.1.6 ... apparently fink knows something about OS X’s library paths that configure doesn’t


Posted by free flash templates  on  01/21  at  03:55 AM



Add Your Comment:

Name:

Email:

URL:

Comment:

Remember my personal information

Notify me of follow-up comments?