繁体   English   中英

AttributeError: 模块“pytesseract”没有属性“run_tesseract”

[英]AttributeError: module 'pytesseract' has no attribute 'run_tesseract'

我正在尝试使用 run_tesseract 函数来获取 hocr 输出,以便从银行收据图像的图像中提取文本。但是我收到了上述错误消息。 我在我的笔记本电脑上安装了 Tesseract-OCR,并将其路径添加到我的系统路径变量中。我有一个 Windows 10 64 位操作系统,

我也尝试卸载并重新安装它,但无济于事。

import glob
import pytesseract
from PIL import Image

img_files=glob.glob('./NACH/*.jpg')
pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files\\Tesseract OCR\\tesseract.exe'
#im=Image.open(img_files[0])
#im.load()

pytesseract.run_tesseract(img_files[0],'output',lang='eng',config='hocr')

我收到以下完整的错误消息:

AttributeError 回溯(最近一次调用最后一次)在

4 im=Image.open(img_files[0])

5 im.load()

----> 6 pytesseract.run_tesseract(img_files[0],'output',lang='eng',config='hocr')

7 #text = pytesseract.image_to_string(im)

8 #if os.path.isfile('output.html'):AttributeError: 模块 'pytesseract' 没有属性 'run_tesseract'

pytesseract.run_tesseract()替换为pytesseract.pytesseract.run_tesseract()

在评论中感谢 Nithin。 添加此作为关闭它的答案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM