'python-imaging on OSX 10.8.1

I am currently checking out django for a project. I am also looking at django-cms. Django-cms requires python-imaging. I can find no simple way to install this on the current version of OSX, in fact it seems I have to build a whole bunch of python extensions before I can even start on getting python-imaging running:

http://wiki.python.org/moin/MacPython/UniversalLibrariesAndExtensions

Is there really no easier way to do this? If not, is it because nobody does this? Do Django developers generally do their work on Linux?



Solution 1:[1]

django-cms requires PIL, the Python Imaging Library. It appears you're referring to python-imaging which is the Ubuntu package name for that requirement. My experience is in building and installing PIL on Mac OS X which seems to be your use case as well. You are correct that PIL requires some C files to be compiled and built as various image algorithms are implemented in C, not in Python.

It used to be possible to install PIL from PyPI (PIL 1.1.6) but that doesn't seem to work anymore. You now have to download and install the desired source version from here or here. After that, the command python setup.py install should be sufficient to install it (this builds the extensions and in turn the Python Imaging Library itself).

Solution 2:[2]

I've written a blog post on this (http://blog.artooro.com/2013/01/04/how-to-install-pil-python-imaging-library-on-mac-os-x-10-8/)

Here are simple instructions that work with the native Apple setup and doesn't require homebrew or macports or anything else.

  1. Install Xcode from the App Store.
  2. Open Xcode and open Xcode Preferences.
  3. Click on the Downloads tab, and you'll see Command Line Tools. Click the Install button to install the Command Line Tools. (This provides gcc to compile PIL)
  4. Now open the Terminal app, and run the following commands:
  5. sudo easy_install pip
  6. sudo pip install PIL

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Simeon Visser
Solution 2 artooro