Environmental description
Window 7, Python 3.6.5
Problem description
When importing based on python, the following error is reported:
>> from PIL import Image
Traceback (most recent call last):
File "<ipython-input-12-0f6709e38f49>", line 1, in <module>
from PIL import Image
File "d:\ProgramData\Anaconda3\lib\site-packages\PIL\Image.py", line 58, in <module>
from . import _imaging as core
ImportError: DLL load failed: The specified module could not be found.
Sometimes, similar errors are reported:
>> from PIL import Image
Traceback (most recent call last):
File "<ipython-input-13-0f6709e38f49>", line 1, in <module>
from PIL import Image
ImportError: cannot import name 'Image'
problem analysis
This kind of problem is usually when installing the library, the security is not complete, or the installed library is covered or damaged, so the corresponding class library cannot be known.
Problem solving
C:\Users\xxxx\>pip install Pillow
Requirement already satisfied: Pillow in d:\programdata\anaconda3\lib\site-packages (5.0.0)
C:\Users\xxxx>pip show Pillow
Name: Pillow
Version: 5.2.0
Summary: Python Imaging Library (Fork)
Home-page: http://python-pillow.org
Author: Alex Clark (Fork Author)
Author-email: [email protected]
License: Standard PIL License
Location: d:\programdata\anaconda3\lib\site-packages
Requires:
Required-by:
It can be seen from the above instructions that the class library has been installed. However, due to its problems, it needs to be re installed.
Uninstall first
pip uninstall Pillow
Uninstalling Pillow-5.0.0:
Would remove:
d:\programdata\anaconda3\lib\site-packages\pillow-5.0.0.dist-info\*
Proceed (y/n)? y
Successfully uninstalled Pillow-5.0.0
Then re install:
pip install Pillow
Collecting Pillow
Downloading https://files.pythonhosted.org/packages/1b/50/869910cd7110157fbefd0fed3db3656c1951f1bceecdd00e3716aa269609/Pillow-5.2.0-cp36-cp36m-win_amd64.whl (1.6MB)
100% |████████████████████████████████| 1.6MB 69kB/s
Installing collected packages: Pillow
Successfully installed Pillow-5.2.0
verification
Then re import the image to find that everything is OK.
summary
If it has been installed but cannot be found, it is likely that the installation is damaged and needs to be re installed.
Read More:
- How to Solve Python Importerror: DLL load failed: unable to find the specified program using tensorflow
- [Solved] wxauto error: ImportError: DLL load failed while importing win32gui: Can’t find the specified program
- ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
- Jupyter notebook Failed to Switch to the Virual Environment: DLL load failed python.exe could not find the entry
- Import win32API; importerror: DLL load failed: the specified program was not found
- import statsmodels.api as sm Error: ImportError: DLL load failed while importing _arpack: The specified program could not be found.
- [Solved] Converting IU to py using pyuic5 – O reports an error importerror: DLL load failed while importing qtcore: the specified module cannot be found.
- [Solved] torchvision Error: UserWarning: Failed to load image Python extension: Could not find module
- [Solved] D2lzh_Pytorch Import error: importerror: DLL load failed while importing
- [Solved] Numpy Load Error: DLL load failed while importing _multiarray_umath: Could not be found Module
- [Solved] librosa Install Error: ImportError: DLL load failed: Could Not Found
- Ctypes DLL Error: FileNotFoundError: Could not find module ‘***_dll.dll‘ (or one of its dependencies).
- [Solved] DLL load failed while importing _sqlite3: the specified module could not be found.
- Pycharm error: original error was: DLL load failed while importing _multiarray _Umath: the specified module could not be found
- FileNotFoundError: Could not find module ‘D:\Anaconda3\envs\labe\Library\bin\geos_c.dll‘ [Solved]
- Python Fatal error: Py_Initialize: unable to load the file system codec
- How to Solve Python ImportError: cannot import name UnrewindableBodyError
- DLL load failed while importing rdBase [How to Solve]
- VScode import numpy Error: DLL load failed [How to Solve]
- [How to Solve] ImportError: No module named typing