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
Comments
-
Hi There,
If you do not use "fink" for whatever reason, and use "maport" instead, then do the following:
port install gd2The gd2 would install a number of the graphics lib, including libjpeg and libpng. you will find them in /opt/local/lib
-
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...
-
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 :)
G
-
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.
-
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/
-
I was trying to manually install libjpeg, then manually install Imaging-1.1.6 ... apparently fink knows something about OS's library paths that configure doesn't
-
It took a little long to install but it worked like a charm once it was installed. Just picked default for all the questions it asked. I am running Leopard on a 2006 MacBook with a number of virtualenvs running different Django sites. The above method install the PIL and libjpeg on the entire Mac so all the virtualenvs can use it
-
I was trying to manually install libjpeg, then manually install Imaging-1.1.6 ... apparently fink knows something about OS's library paths that configure doesn't
-
Thank you so much for this.
Comments on this post are closed.