cannot import name '_imaging' 报错

例子如下:

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'

解决方法:

先卸载掉原版本的pillow:

 pip uninstall pillow

在安装4.0.0版本的pillow:

pip install pillow==4.0.0

猜你喜欢

转载自www.cnblogs.com/carlber/p/10237003.html