Search code examples
python-3.xpippython-importpython-module

Installed PILLOW Module is not Identifying to Import in Python 3


I have installed the PILLOW module in Windows 8.1 for Python 3 using the below command.

pip install pillow

The installation was a success.

Unfortunately when I tried to import the image sub-module within it using the below statement I got an import error.

from PIL import image

Error: ImportError: cannot import name 'image' from 'PIL' (C:\Program Files\Python38\lib\site-packages\PIL_init_.py)

Although the below statement is giving me an error for the 'PIL' .

image = PIL.Image.open("Capture Image.PNG")

Error: Undefined variable: ' PIL'Python(undefined-variable)

I have tried similar posts listed below, but they didn't help me to solve the issue.

  1. Pip install Pillow: "no module named Pillow?"
  2. Pillow installed, but getting "no module named pillow" when importing
  3. Python pillow module not importing properly

Could you please someone explain what I'm missing here?

Regards, Chiranthaka


Solution

  • @dragon2fly Many thanks for solving the issue. Please refer the below snippet for the complete source code.

    from PIL import Image
    
    image = Image.open("Capture_image.png")
    
    print(image.size)