I don't have 10.5.8 to test this, so YMMV (works on 10.6):
- Install MacPorts (Leopard version): http://www.macports.org/install.php
- Applications -> Utilities -> Terminal
- $ sudo port install python27
- $ sudo port install py27-pip
Install PIL either via MacPorts or pip (whichever works - DON'T RUN BOTH):
- $ sudo port install py27-pil
- $ sudo pip-2.7 install PIL
Launch Python 2.7 and test it out:
$ python2.7
>>> import PIL
>>> PIL
<module 'PIL' from '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/__init__.pyc'>
Remember, you have to type $ python2.7
, since $ python
will continue to load the OS X version of Python, which is 2.5 I believe...
This means any scripts you write with #!/usr/bin/env python
at the top will use the non-PIL Python 2.5. You'll have to change them to #!/opt/local/bin/python2.7
for PIL-Python 2.7. Or...
You can easily change whichever Python version $ python
loads, and ignore that header madness, by installing python_select:
$ sudo port install python_select
...installs stuff...
$ sudo python_select python27
Now, whenever you run $ python
, it'll load Python 2.7, and not OS X Python 2.5. You can easily switch back anytime. Just run $ python_select -l
and you'll see the -apple version of Python. On 10.6: $ sudo python_select python26-apple