【发布时间】:2013-01-16 10:10:04
【问题描述】:
我最近在 python 中使用了 tesseract OCR,当我尝试从 tesseract 导入 image_to_string 时,我一直收到错误消息。
导致问题的代码:
# Perform OCR using tesseract-ocr library
from tesseract import image_to_string
image = Image.open('input-NEAREST.tif')
print image_to_string(image)
以上代码导致的错误:
Traceback (most recent call last):
file "./captcha.py", line 52, in <module>
from tesseract import image_to_string
ImportError: cannot import name image_to_string
我已验证安装了 tesseract 模块:
digital_alchemy@roaming-gnome /home $ pydoc modules | grep 'tesseract'
Hdf5StubImagePlugin _tesseract gzip sipconfig
ORBit cairo mako tesseract
我相信我已经获得了所有必需的包,但不幸的是我只是停留在这一点上。看来该功能不在模块中。
非常感谢任何帮助。
【问题讨论】:
-
尝试“import tesseract.image_to_string”,甚至只是“import tesseract”。
-
我认为你有错误的 python 绑定...
vars(tesseract)中有什么?