I want to do some image processing and I encountered a problem. Importing the pillow module doesn't seem to work. I found a simple script here to check what packages are installed and I found it, but importing it doesn't seem to work.
Here's the code I'm trying to run:
import pip
installed_packages = pip.get_installed_distributions()
installed_pillow_packages = [
"%s==%s" % (i.key, i.version)
for i in installed_packages
if "pil" in i.key.lower()
]
print(installed_pillow_packages)
import pillow
And here's the result:
runfile('C:/Users/Augustas/.spyder2/temp.py', wdir=r'C:/Users/Augustas/.spyder2')
['pillow==2.6.1']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 601, in runfile
execfile(filename, namespace)
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 66, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Users/Augustas/.spyder2/temp.py", line 7, in <module>
import pillow
ImportError: No module named pillow
I'm running this on Windows 8.1 using Spyder and Python 2.7.9.
You are importing incorrectly. Try using:
import PIL
or
from PIL import Image
PIL
, i.e., Python Imaging Library is no longer maintained, Pillow
is used instead. To maintain backwards compatibility, the PIL
module name is used in imports.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With