Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install PIL on mac os x 10.7.2 Lion

I've tried googling & looking up some other people's questions. However, I still couldn't find a clear/simple recipe to install PIL (for python 2.6 or 2.7) on mac os x 10.7.2 Lion.

like image 920
user1178887 Avatar asked Jan 30 '12 20:01

user1178887


People also ask

How do I import a python Pillow?

To load the image, we simply import the image module from the pillow and call the Image. open(), passing the image filename. Instead of calling the Pillow module, we will call the PIL module as to make it backward compatible with an older module called Python Imaging Library (PIL).

How do I check my Pillow on Anaconda prompt?

To check which version of the Python library pillow is installed, run pip show pillow or pip3 show pillow in your CMD/Powershell (Windows), or terminal (macOS/Linux/Ubuntu).


1 Answers

If you use homebrew, you can install the PIL with just brew install pil. You may then need to add the install directory ($(brew --prefix)/lib/python2.7/site-packages) to your PYTHONPATH, or add the location of PIL directory itself in a file called PIL.pth file in any of your site-packages directories, with the contents:

/usr/local/lib/python2.7/site-packages/PIL 

(assuming brew --prefix is /usr/local).

Alternatively, you can just download/build/install it from source:

# download curl -O -L http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz # extract tar -xzf Imaging-1.1.7.tar.gz cd Imaging-1.1.7 # build and install python setup.py build sudo python setup.py install # or install it for just you without requiring admin permissions: # python setup.py install --user 

I ran the above just now (on OSX 10.7.2, with XCode 4.2.1 and System Python 2.7.1) and it built just fine, though there is a possibility that something in my environment is non-default.

like image 86
minrk Avatar answered Sep 22 '22 05:09

minrk