close

[Solved] ImportError: No module named PIL

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error ImportError: No module named PIL in Python. So Here I am Explain to you all the possible solutions here.

Without Wasting your time, Lets start This Article to Solve This Error.

How To Solve ImportError: No module named PIL ?

Question: How To Solve ImportError: No module named PIL ?
Answer: To Solve ImportError: No module named PIL Just Check if from PIL import Image works. pip install –upgrade –force-reinstall pillow . The same for matplotlib. Perhaps you have PIL installed (it’s something a bit different). Uninstall it. Some info on the net says that you should also pip install image.

Just Try This

1Check if from PIL import Image works.
2pip install –upgrade –force-reinstall pillow . The same for matplotlib.
3Perhaps you have PIL installed (it’s something a bit different). Uninstall it.
4Some info on the net says that you should also pip install image.

Solution 1

On some installs of PIL, you must do

import Image

instead of import PIL (PIL is in fact not always imported this way). Since import Image works for you, this means that you have in fact installed PIL.

Having a different name for the library and the Python module is unusual, but this is what was chosen for (some versions of) PIL.

Solution 2

In shell, run:

pip install Pillow

Attention: PIL is deprecated, and pillow is the successor.

Solution 3

On a different note, I can highly recommend the use of Pillow which is backwards compatible with PIL and is better maintained/will work on newer systems.

When that is installed you can do

import PIL 

or

from PIL import Image

etc..

Solution 4

At first install Pillow with

pip install Pillow

or as follows

c:\Python35>python -m pip install Pillow

Then in python code you may call

from PIL import Image

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment