Python Forum

Full Version: import PIL dont work
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I'm having a similar issue.
I have Python v.3.7.4 & PyCharm.
I uninstalled PIL.
I downloaded Pillow.
I did the "pip install Pillow" command from the command prompt.
However, when I tried running "from Pillow import *"
in my python program, it said "ModuleNotFoundError: No module named 'Pillow'"

I contacted someone yesterday at PyCharm.
He was not able to help me.
He said that it might be a compatibility issue.
He said to go to the Python forums to see if someone can help me.

Any help would be greatly appreciated.
(Feb-22-2020, 12:00 AM)vman44 Wrote: [ -> ]However, when I tried running "from Pillow import *"
The import have not change to keep backward compatibility.
>>> from PIL import Image

# It's Pillow version 7.0 that used now
>>> Image.__version__
'7.0.0'

>>> im = Image.open("sword.png")
>>> im.info
{'dpi': (600, 600)}
>>> im.rotate(90).show()
Look at doc
That worked.

Thanks, snippsat.
Actually, I don't think it worked.
It displayed the png image,
but PyCharm stated:
"AttributeError: type object 'Image' has no attribute 'open'"

Also, how do I display jpg images?
Check that you do not have a file named pillow,Image or PIL .py.
You can test,it should point to root installation site-packages folder.
>>> from PIL import Image
>>>
>>> Image.__file__
'c:\\python37\\lib\\site-packages\\PIL\\Image.py'
(Feb-22-2020, 07:00 PM)vman44 Wrote: [ -> ]Also, how do I display jpg images?
Supported Image file formats
Pages: 1 2