【发布时间】:2018-03-19 17:28:02
【问题描述】:
我最近安装了 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(带前导点) -
它没有用。现在它给出了以下错误:
-
Traceback(最近一次调用最后):文件“/Users/esat/Desktop/Noting/Program/Code/OCR.py”,第 2 行,在
from .tesseract import image_to_string ModuleNotFoundError:没有名为 'main.tesseract' 的模块; 'main' 不是包
标签: tesseract