Installing PIL on Mac OS X Leopard virtualenv with easy_install

by Nathan Van Gheem last modified Feb 11, 2010 12:30 PM
What do you do when you need to install PIL in a virtualenv on Mac OS X and it won't build for you? I'll walk through getting it to work.
Post

First off

If when you try installing PIL, you get an error like this
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/nO/nOf0lGB+GlGrFGnhcyaFPE+++TI/-Tmp-//ccqHwR4o.out (No such file or directory)
error: Setup script exited with error: command 'gcc' failed with exit status 1

Then it's failing because it doesn't have the universal versions of some packages installed. 

You'll first need to install MacPorts. You can download the dmg install file or just go to the MacPorts installation page for instructions on how to get it setup on your system.

Installing Universal Packages

 
Open up a terminal window and run these commands,
sudo port install libiconv +universal
sudo port upgrade --enforce-variants zlib +universal
sudo port install jpeg +universal
sudo port install freetype2	 +universal

Now Install PIL 

 
Now you should be able to run
./bin/easy_install http://dist.repoze.org/PIL-1.1.6.tar.gz

 This is a version of PIL that plays nice with setuptools.

comments powered by Disqus

Navigation