【问题标题】:Importing PIL, more specifically Image from PIL, isn't working导入 PIL,更具体地说是从 PIL 导入图像,不起作用
【发布时间】:2017-09-02 05:25:53
【问题描述】:

这是对我所做工作的描述。

我正在尝试使用 PIL 编写程序,但是在尝试导入它时(如下所示),出现错误(也如下所示)。

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.

我尝试过简单的import Image:

但是,它也显示错误:

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'

以下是我为解决该问题而尝试做的一个非常简短的列表:

  • 正在安装 PIL(找不到满足 PIL 要求的版本(来自版本:)没有找到 PIL 的匹配发行版),我只想说,它不起作用;
  • 正在卸载 PIL,但我无法卸载我未安装的内容(无法卸载要求 PIL,未安装);
  • 我试过安装枕头,但是已经安装好了;
  • 我试图卸载枕头(然后重新安装,看看它是否会工作),它没有解决任何问题。

这就是我所尝试的。如果有人可以帮助我,我们将不胜感激,如果需要提供任何进一步的信息,可以并且将会提供。

【问题讨论】:

标签: python python-3.x python-imaging-library


【解决方案1】:

存在一个 Python 问题,这意味着针对 Python 3.6.1 构建的轮子(例如 Pillow 4.1.0)无法在 Python 3.6.0 上运行。

修复方法是更新到 Python 3.6.1,或安装 Pillow 4.0.0(针对 Python 3.6.0 构建)。

有关详细信息,请参阅: https://github.com/python-pillow/Pillow/issues/2479 https://mail.python.org/pipermail/python-dev/2017-March/147707.html https://bugs.python.org/issue29943


更新:

这影响了许多 Python 库。

但是,新的 Pillow 4.1.1 版本可以解决此问题,因此您现在可以更新到 Pillow 4.1.1 并将其与 Python 3.6.0 和 3.6.1 一起使用。

【讨论】:

  • 非常感谢@Hugo 的帮助,它解决了这个问题!我自己无法找到这类信息。
  • 我最近遇到了同样的问题from . import _imaging as core ImportError: DLL load failed: The specified procedure could not be found.,Anaconda Navigator 1.6.12 运行 Python 3.6.4。我正在加载 PIL 4.3.0。通过 Anaconda Navigator 将 PIL 升级到 5.0.0 并没有修复它。我最终通过以下两步程序修复了它。 1.通过conda remove --force pillow卸载它 2.重新安装。由于担心原始 Anaconda 发行版有问题,我从 conda-forge 重新安装,而不是 conda 的默认值。所以我用conda install -c conda-forge pillow
猜你喜欢
  • 2013-10-08
  • 1970-01-01
  • 2014-12-17
  • 2019-08-13
  • 2021-02-12
  • 2016-10-12
  • 2020-04-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多