gpt4 book ai didi

python - PIL 和枕头。导入错误 : cannot import name '_imaging'

转载 作者:太空狗 更新时间:2023-10-30 01:37:30 32 4
gpt4 key购买 nike

运行

from PIL import Image
import pytesseract as pt

text = pt.image_to_string(Image.open("text.png"))

给我

Traceback (most recent call last):
File "C:\Users\Rasmus\workspace\PythonMTGO\src\OCR.py", line 1, in <module>
from PIL import Image
File "C:\Users\Rasmus\AppData\Local\Programs\Python\Python35\lib\site-packages\PIL\Image.py", line 66, in <module>
from PIL import _imaging as core
ImportError: cannot import name '_imaging'

我从 https://pypi.python.org/pypi/Pillow/3.0.0 安装了枕头对于 python 3.5

我看到一个答案说 PIL 和 pillow 不能一起工作?但是,如果我从上面的链接安装 Windows msi 安装程序,它将安装 PIL 和枕头并将其放入 C:\Users\Rasmus\AppData\Local\Programs\Python\Python35\Lib\site-packages

我花了一整天的时间让 3 行代码正常工作。希望任何人都知道可能出了什么问题。

最佳答案

你的枕头是什么版本,

Pillow >= 2.1.0 no longer supports “import _imaging”. Please use “from PIL.Image import core as _imaging” instead.

这是官方文档

https://pillow.readthedocs.io/en/5.1.x/installation.html#warnings

关于python - PIL 和枕头。导入错误 : cannot import name '_imaging' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36792639/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com