Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install PIL on Mac OSX 10.5.8 for Google App Engine?

I need to get PIL installed locally to test GAE's images api in my local environment.

I grabbed the PIL 1.1.6 installer for Mac, and when I go to select the destination (when installing), I get the error:

You cannot install PIL 1.1.6 on this volume. 
PIL requires System Python 2.5 to install.

I have Python 2.5.x on this machine.

NOTE:

Added a bounty. I am in real need of a way to test the image API locally on my Mac.

like image 638
Will Curran Avatar asked Feb 01 '11 21:02

Will Curran


2 Answers

That's quite easy:

  1. Install MacPorts
  2. Install Python 2.5 with sudo port install python25
  3. Install Pil for Python 2.5 with sudo port install py25-pil
  4. In the Google App Engine launcher Preferences set /opt/local/bin/python2.5 as Python Path *
  5. Restart the Google App Engine launcher
  6. Happy coding

* be sure to confirm it with an ENTER or it will not persist

like image 188
systempuntoout Avatar answered Oct 04 '22 15:10

systempuntoout


I would install homebrew, and use that to install python2.7 (a requirement for pip to work properly together with homebrew) and then use pip to install PIL.

If you don't have macports or fink or something installed already, this is simple. If you do, you might want to look into removing it first (especially if they live in /usr/local).

Installing homebrew: https://github.com/mxcl/homebrew/wiki/Installation

(If you have Xcode installed (you need a compiler) you can just use this one-liner, but I recommend you read the instructions first so you understand what it does.)

ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"

Installing python 2.7:

brew install python

Just remember to add the homebrew python as well as your homebrew bin directory to the front of your $PATH after installing (put this in your ~/.bashrc):

export PATH=/usr/local/bin:/usr/local/Cellar/python/2.7.1/bin:$PATH

Installing PIL: (it seems like my installation is linked against libjpeg, so install that first)

brew install jpeg
pip install pil

There you go.

like image 42
oyvindio Avatar answered Oct 04 '22 14:10

oyvindio