Installing Python Imaging Library (PIL) on Snow Leopard with updated Python 2.6.2

Viewed 30961

I have a fresh install (started with a wiped drive) of Snow Leopard with the developer tools installed during the Snow Leopard installation.

I then installed Python 2.6.2, replacing the Snow Leopard default python 2.6.1. I've tried to install PIL by:

  1. easy_install
  2. pip
  3. downloading source and running python setup.py build manually.

All yield the same error (link to pip log: http://drop.io/gi2bgw6). I've seen others have had success installing PIL using the Snow Leopard default python 2.6.1, so I'm not sure why I'm having so much trouble getting it to work with 2.6.2.

12 Answers

The problem I ran into was that PIL was being compiled against PowerPC architecture (-arch ppc).

Do this before setup/build/compile:

export ARCHFLAGS="-arch i386"

(Assuming you're on i386)

10.6 Snow Leopard install PIL without the hassle and without keeping MacPorts :)

Step 1: Install MacPorts
Step 2: sudo port install py26-pil
Step 3: mv /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/* /Library/Python/2.6/site-packages/
Step 4: Uninstall MacPorts

Best of both worlds?

On OS X Lion with current XCode and no gcc-4.0 I'm able to get around the missing stdard.h error by setting the follow environment variables:

export CC="/usr/bin/llvm-gcc-4.2"

I can't say I understand why this works.

By the way this works for the Pillow fork of PIL too.

Related