ImportError: No module named Image

PythonMacosPython Imaging-Library

Python Problem Overview


I have also tried

from PIL import Image

but it gives me ImportError: No module named PIL.

I have installed PIL successfully using

pip install pil

and I've also installed xcode command line tools. Nothing seem to work.

Details:

Mac OS X 10.9

Python 2.7.6

python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python

python is /usr/bin/python

python is /usr/local/bin/python

Name: PIL

Version: 1.1.7

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

Python Solutions


Solution 1 - Python

The PIL distribution is mispackaged for egg installation.

Install Pillow instead, the friendly PIL fork.

Solution 2 - Python

On a system with both Python 2 and 3 installed and with pip2-installed Pillow failing to provide Image, it is possible to install PIL for Python 2 in a way that will solve ImportError: No module named Image:

easy_install-2.7 --user PIL

or

sudo easy_install-2.7 PIL

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmihaliosView Question on Stackoverflow
Solution 1 - PythonMartijn PietersView Answer on Stackoverflow
Solution 2 - PythonqubodupView Answer on Stackoverflow