例子如下:
from PIL import Image
import pytesseract as pt
text = pt.image_to_string(Image.open("text.png"))
运行结果:
Traceback (most recent call last):
File "C:UsersRasmusworkspacePythonMTGOsrcOCR.py", line 1, in <module>
from PIL import Image
File "C:UsersRasmusAppDataLocalProgramsPythonPython35libsite-packagesPILImage.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