Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pillow installed, but getting "no module named pillow" when importing

I installed the Pillow package with:

python -m pip install pillow 

Got success message (Successfully installed pillow). Closed and re-opened the terminal.

But when I try to:

import pillow 

I get the error message:

ImportError: No module named pillow

If python -m pip install pillow is run again, it says

Requirement already satisfied (use --upgrade to upgrade): pillow in c:\python27\lib\site-packages 
like image 714
billrichards Avatar asked May 23 '14 16:05

billrichards


People also ask

How do I know if Pillow is installed?

Step 2: To check if PIL is successfully installed, open up the python terminal by typing python3 in the terminal. This will open up the python3 interactive console now type the following command to check the current version of the PIL. This will output the currently installed version of the PIL.

Why is PIL module not found?

The Python "ModuleNotFoundError: No module named 'PIL'" occurs when we forget to install the Pillow module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install Pillow command.

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).


1 Answers

Try using

import PIL 

or

from PIL import ... 

instead. Pillow is a fork of PIL, the Python Imaging Library, which is no longer maintained. However, to maintain backwards compatibility, the old module name is used.

like image 184
MattDMo Avatar answered Oct 14 '22 08:10

MattDMo