PIL: DLL load failed: specified procedure could no

2019-01-14 15:10发布

I've been beginning to work with images in Python and I wanted to start using PIL (Pillow). To install it, I ran pip install Pillow. When installing, PIL was not previously installed. I also tried uninstalling it and reinstalling it, as well as using pip3 install Pillow.

When I run it in Python, my first line is:

File "C:\Program Files\Python36\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 checked the directory, and the file _imaging.cp36-win_amd64.pyd is present under the PIL folder.

Why is this happening if the needed DLL is there? How can I fix it?

7条回答
趁早两清
2楼-- · 2019-01-14 15:37

As in Sean's answer, I had to uninstall (I'm using Anaconda Python 3.6, BTW) with

conda uninstall pillow

I tried it with PIL, but there was no such package. Uninstalling pillow also meant uninstalling packages that depend on it, in my case "anaconda-navigator" and "scikit-image". After I reinstalled Pillow 4.0.0 with

 conda install pillow=4.0.0

and tested it with

python -c "from PIL import Image"

which, if successful, you don't see an error message, I reinstalled the packages that were uninstalled along with Pillow 4.1.0.

conda install anaconda-navigator
conda install scikit-image
查看更多
神经病院院长
3楼-- · 2019-01-14 15:40

This works for me using win10 and py 3.6. Simply uninstall Pillow 4.1.0 pip3 uninstall Pillow Then install Pillow 4.0.0 pip3 install Pillow==4.0.0

查看更多
混吃等死
4楼-- · 2019-01-14 15:43

This problem is also fixed by upgrading Python to 3.6.1, per this GitHub discussion.

The difference is that Pillow 4.1.0 was built with Python 3.6.1 while Pillow 4.0.0 was built with Python 3.6.0.

Apparently PYTHON36.DLL from Python 3.6.0 is missing functions (PySlice_AdjustIndices and PySlice_Unpack) that are used when building with Python 3.6.1.

The solution is to upgrade to Python 3.6.1.

查看更多
何必那么认真
5楼-- · 2019-01-14 15:51

I had this problem as well with Python 3.6. I just avoided the problem by uninstalling pillow (4.1.0) and then installing an older version of pillow (4.0.0). It seems to run okay with the older version.

查看更多
倾城 Initia
6楼-- · 2019-01-14 15:52

If you're using Anaconda, try

conda uninstall pillow and then pip install pillow

Came across this issue while working on Caffe2 on Windows 10 (Anaconda 4.5) and this worked for me. Here's the github post on this issue.

查看更多
爱情/是我丢掉的垃圾
7楼-- · 2019-01-14 15:55

There's a problem in Python itself which means binary wheels build using Python 3.6.1 (like Pillow 4.1.0) won't install on Python 3.6.0.

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.

More info:

查看更多
登录 后发表回答