I'm trying to write a program using PIL, but, when trying to import it (as shown bellow), an error appears (also shown below).
from PIL import Image
Here is the error.
Traceback (most recent call last):
File "C:/Users/user/Desktop/Wook/Test Bench.py", line 1, in <module>
from PIL import Image
File "C:\Python\lib\site-packages\PIL\Image.py", line 56, in <module>
from . import _imaging as core
ImportError: DLL load failed: The specified procedure could not be found.
I have tried to simply import Image
:
But, it also displays an error:
Here is the error to the second situation.
Traceback (most recent call last):
File "C:/Users/user/Desktop/Wook/Test Bench.py", line 1, in <module>
import Image
ModuleNotFoundError: No module named 'Image'
That's all I've tried. If anyone can help me, it would be deeply appreciated, and if, any further information needs to be provided, it can, and will, be provided.
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.
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).
Pillow was announced as a replacement for PIL for future usage. Pillow supports a large number of image file formats including BMP, PNG, JPEG, and TIFF.
Pillow reads and writes JPEG 2000 files containing L , LA , RGB or RGBA data. It can also read files containing YCbCr data, which it converts on read into RGB or RGBA depending on whether or not there is an alpha channel.
There's a Python problem which means wheels built against Python 3.6.1, such as Pillow 4.1.0, won't work on Python 3.6.0.
The fix is to update to Python 3.6.1, or install Pillow 4.0.0 (which was built against Python 3.6.0).
For more info see: https://github.com/python-pillow/Pillow/issues/2479 https://mail.python.org/pipermail/python-dev/2017-March/147707.html https://bugs.python.org/issue29943
Update:
This has affected a number of Python libraries.
However, there's the new Pillow 4.1.1 release works around this, so you can now update to Pillow 4.1.1 and use it with both Python 3.6.0 and 3.6.1.
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