Python PIL:DLL 加载失败:找不到指定的过程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43264773/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PIL: DLL load failed: specified procedure could not be found
提问by MLavrentyev
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(枕头)。为了安装它,我运行了pip install Pillow
. 安装时,之前没有安装 PIL。我也尝试卸载它并重新安装它,以及使用pip3 install 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 存在,为什么会发生这种情况?我该如何解决?
回答by Sean
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)来避免这个问题。它似乎与旧版本运行良好。
回答by Ed Bernal
As in Sean's answer, I had to uninstall (I'm using Anaconda Python 3.6, BTW) with
正如肖恩的回答,我不得不卸载(我使用的是 Anaconda Python 3.6,顺便说一句)
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
回答by rakidedigama
If you're using Anaconda, try
如果您使用的是 Anaconda,请尝试
conda uninstall pillow
and then pip install pillow
conda uninstall pillow
进而 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 poston this issue.
在 Windows 10 (Anaconda 4.5) 上使用 Caffe2 时遇到了这个问题,这对我有用。这是有关此问题的github 帖子。
回答by Joseph Montanaro
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.
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.The solution is to upgrade to Python 3.6.1.
不同之处在于 Pillow 4.1.0 是用 Python 3.6.1 构建的,而 Pillow 4.0.0 是用 Python 3.6.0 构建的。
显然
PYTHON36.DLL
,Python 3.6.0 缺少使用 Python 3.6.1 构建时使用的函数(PySlice_AdjustIndices
和PySlice_Unpack
)。解决方案是升级到 Python 3.6.1。
回答by Hugo
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:
更多信息:
回答by Khan
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 install PIL
it worked for me.
它对我有用。
回答by Rohit Gupta
Seems like some issue is there with tensorflow 1.12.0 +Python 3.6.0 + win10
tensorflow 1.12.0 +Python 3.6.0 + win10 似乎存在一些问题
Working fine with conda tensorflow.
使用 conda tensorflow 工作正常。
below steps worked for me for pip tensorflow.
以下步骤对我来说适用于 pip tensorflow。
uninstall tensorflow replace your python version with 3.6.1 install latest version of tensorflow(1.13.0)
卸载 tensorflow 用 3.6.1 替换你的 python 版本 安装最新版本的 tensorflow(1.13.0)
For installing Tensorflow follow below link:- https://www.tensorflow.org/install/pip
要安装 Tensorflow,请遵循以下链接:- https://www.tensorflow.org/install/pip
回答by dsixnine
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 uninstall Pillow 然后安装 Pillow 4.0.0 pip3 install Pillow==4.0.0