我最近安装了Tesseract模块并找到了一些教程,但是在网上没有我遇到的问题的解决方案。以下是简单的代码和报错信息:
from PIL import Image
from tesseract import image_to_string
a = Image.open('/Users/bob/Desktop/108.jpg')
b = image_to_string(a)
print(b)
以下是错误信息:
print 'Creating user config file: {}'.format(_config_file_usr)
^
SyntaxError: invalid syntax
这是图片:108.png。
from tesseract import image_to_string
更改为from .tesseract import image_to_string
(带有点号的前导) - Dmitrii Z.