Python - package installed with easy_install not found (PIL 1.1.7)

I installed PIL with easy_install, but for some reason, when I run a file that uses it, I get:

ImportError: No module named PIL 

Does anyone know why this could be?

I think it's also worth mentioning that I installed web.py through easy_install and it works great.

+7
source share
5 answers

I have the same problem. For me, it looks like an error in the PIL easy_install process. The library is installed, but you must leave the PIL from the import (aka import Image works), which is obviously wrong.

To solve the problem, do not use easy_install to complete the installation. Download the tar package and python setup.py install it. This will work.

+7
source

Perhaps this file uses another python through its shebang line? Try the interactive interpreter and make an import pil and see if it works, if so, fixing the shebang line ( #!/usr/bin/python ) on top of the file in the question can help.

+4
source

Is the file you're working on using the same version of Python you installed PIL on?

If, for example, the file uses python 2.7, but your system also has 2.6, and PIL was installed there. This can be a problem.

Using easy_install with a version number may help:

 easy_install-XX pil 

so for python 2.7 it will be:

 easy_install-2.7 pil 

PIL also has some naming problems when used with easy_install, see:

But even with this, you can still import pil, so I donโ€™t think this is a problem.

Hope this helps.

+3
source

if you are using MAC OS, I wrote a small tutorial on how to install libjpeg, PIL and image successfully on MAC OS X

Hope this helps. Libjpeg, PIL, Snow leopard

+2
source

I had the same problem as setting up PIL after installing mac os Lion. This article A problem installing PIL using virtualenv or buildout shows installation directives using a fixed version link.

Regards, AT

+1
source

All Articles