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
.
我已经开始使用Python中的图像了,我想开始使用PIL(Pillow)。为了安装它,我运行了pip install Pillow。安装时,之前未安装PIL。我也尝试卸载它并重新安装它,以及使用pip3安装Pillow。
When I run it in Python, my first line is:
当我在Python中运行它时,我的第一行是:
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.
我检查了目录,文件_imaging.cp36-win_amd64.pyd存在于PIL文件夹下。
Why is this happening if the needed DLL is there? How can I fix it?
如果需要的DLL存在,为什么会发生这种情况?我该如何解决?
7 个解决方案
#1
36
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.
我在Python 3.6中遇到了这个问题。我只是通过卸载枕头(4.1.0)然后安装旧版本的枕头(4.0.0)来避免这个问题。它似乎与旧版本运行良好。
#2
21
As in Sean's answer, I had to uninstall (I'm using Anaconda Python 3.6, BTW) with
正如在Sean的回答中,我不得不卸载(我正在使用Anaconda Python 3.6,BTW)
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
我用PIL尝试过,但是没有这样的包。卸载枕头也意味着卸载依赖它的软件包,在我的案例中是“anaconda-navigator”和“scikit-image”。我重新安装Pillow 4.0.0之后
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.
如果成功,您没有看到错误消息,我重新安装了与Pillow 4.1.0一起卸载的软件包。
conda install anaconda-navigator
conda install scikit-image
#3
5
This problem is also fixed by upgrading Python to 3.6.1, per this GitHub discussion.
根据GitHub讨论,将Python升级到3.6.1也可以解决这个问题。
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.
不同之处在于Pillow 4.1.0是使用Python 3.6.1构建的,而Pillow 4.0.0是使用Python 3.6.0构建的。
Apparently
PYTHON36.DLL
from Python 3.6.0 is missing functions (PySlice_AdjustIndices
andPySlice_Unpack
) that are used when building with Python 3.6.1.显然,Python 3.6.0中的PYTHON36.DLL缺少在使用Python 3.6.1构建时使用的函数(PySlice_AdjustIndices和PySlice_Unpack)。
The solution is to upgrade to Python 3.6.1.
解决方案是升级到Python 3.6.1。
#4
2
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.
Python本身存在一个问题,这意味着使用Python 3.6.1(如Pillow 4.1.0)构建的二进制轮不会安装在Python 3.6.0上。
This has affected a number of Python libraries.
这影响了许多Python库。
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.
但是,新的Pillow 4.1.1版本可以解决这个问题,因此您现在可以更新到Pillow 4.1.1并将其与Python 3.6.0和3.6.1一起使用。
More info:
#5
1
I had the same problem with anaconda 5.0.1, using it with caffe on windows 10. i just did
我在anaconda 5.0.1上遇到了同样的问题,在Windows 10上使用了caffe。我刚才这样做了
conda install PIL
conda安装PIL
it worked for me.
它对我有用。
#6
0
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
这适用于我使用win10和py 3.6。只需卸载Pillow 4.1.0 pip3卸载Pillow然后安装Pillow 4.0.0 pip3安装Pillow == 4.0.0
#7
0
If you're using Anaconda, try
如果您正在使用Anaconda,请尝试
conda uninstall pillow
and then pip install pillow
conda卸载枕头,然后pip安装枕头
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.
在Windows 10(Anaconda 4.5)上使用Caffe2时遇到了这个问题,这对我有用。这是关于这个问题的github帖子。
#1
36
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.
我在Python 3.6中遇到了这个问题。我只是通过卸载枕头(4.1.0)然后安装旧版本的枕头(4.0.0)来避免这个问题。它似乎与旧版本运行良好。
#2
21
As in Sean's answer, I had to uninstall (I'm using Anaconda Python 3.6, BTW) with
正如在Sean的回答中,我不得不卸载(我正在使用Anaconda Python 3.6,BTW)
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
我用PIL尝试过,但是没有这样的包。卸载枕头也意味着卸载依赖它的软件包,在我的案例中是“anaconda-navigator”和“scikit-image”。我重新安装Pillow 4.0.0之后
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.
如果成功,您没有看到错误消息,我重新安装了与Pillow 4.1.0一起卸载的软件包。
conda install anaconda-navigator
conda install scikit-image
#3
5
This problem is also fixed by upgrading Python to 3.6.1, per this GitHub discussion.
根据GitHub讨论,将Python升级到3.6.1也可以解决这个问题。
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.
不同之处在于Pillow 4.1.0是使用Python 3.6.1构建的,而Pillow 4.0.0是使用Python 3.6.0构建的。
Apparently
PYTHON36.DLL
from Python 3.6.0 is missing functions (PySlice_AdjustIndices
andPySlice_Unpack
) that are used when building with Python 3.6.1.显然,Python 3.6.0中的PYTHON36.DLL缺少在使用Python 3.6.1构建时使用的函数(PySlice_AdjustIndices和PySlice_Unpack)。
The solution is to upgrade to Python 3.6.1.
解决方案是升级到Python 3.6.1。
#4
2
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.
Python本身存在一个问题,这意味着使用Python 3.6.1(如Pillow 4.1.0)构建的二进制轮不会安装在Python 3.6.0上。
This has affected a number of Python libraries.
这影响了许多Python库。
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.
但是,新的Pillow 4.1.1版本可以解决这个问题,因此您现在可以更新到Pillow 4.1.1并将其与Python 3.6.0和3.6.1一起使用。
More info:
#5
1
I had the same problem with anaconda 5.0.1, using it with caffe on windows 10. i just did
我在anaconda 5.0.1上遇到了同样的问题,在Windows 10上使用了caffe。我刚才这样做了
conda install PIL
conda安装PIL
it worked for me.
它对我有用。
#6
0
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
这适用于我使用win10和py 3.6。只需卸载Pillow 4.1.0 pip3卸载Pillow然后安装Pillow 4.0.0 pip3安装Pillow == 4.0.0
#7
0
If you're using Anaconda, try
如果您正在使用Anaconda,请尝试
conda uninstall pillow
and then pip install pillow
conda卸载枕头,然后pip安装枕头
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.
在Windows 10(Anaconda 4.5)上使用Caffe2时遇到了这个问题,这对我有用。这是关于这个问题的github帖子。