Here is what I did, some steps may not be necessary just for PIL but I needed libpng and others anyways:
1) Run xcode install, use this command or download updates from the app store:
xcode-select --install
1b) Add the Command Line Tools optional tool, in Mountain Lion this was an option on the xcode Download page, but now you have to register with your apple id and download from: https://developer.apple.com/downloads/
Look for Command Line Tools (OS X Mavericks) for Xcode
2) Install everything needed for python (using brew), I believe you can use port as well:
brew install readline sqlite gdbm
brew install python --universal --framework
brew install libpng jpeg freetype
Unlink/ relink if needed i.e. if upgrading.
3) Install Pip and required modules:
easy_install pip
sudo pip install setuptools --no-use-wheel --upgrade
4) Finally this works with no errors:
sudo pip install Pillow
UPDATE 11/04/14: PIL repo no longer receives updates or support so Pillow should be used. The below is now deprecated so stick with Pillow.
sudo pip install pil --allow-external pil --allow-unverified pil
UPDATE (OLD) : The same thing applies when installing Pillow (PIL fork) and should be mentioned as its quickly becoming a replacement in most cases of PIL. Instead of installing pip in step 4, run this instead:
sudo pip install Pillow
Hope this helps someone!
pip install pillow
– Carterpip install Pillow==5.0.0
works, installs.../site-packages/PIL
. (Why 5.0.0 ? See the issue ). – Inclinatory