import PIL dont work - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: import PIL dont work (/thread-23770.html) Pages:
1
2
|
RE: import PIL dont work - vman44 - Feb-22-2020 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. RE: import PIL dont work - snippsat - Feb-22-2020 (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 RE: import PIL dont work - vman44 - Feb-22-2020 That worked. Thanks, snippsat. RE: import PIL dont work - vman44 - Feb-22-2020 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? RE: import PIL dont work - snippsat - Feb-22-2020 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 |