我试图使用run_tesseract函数来获得一个hocr输出,用于从银行收据images.However的图像中提取文本,我得到了上述错误消息。我在我的笔记本电脑上安装了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) 5 im.load() -6 pytesseract.run_tesseract(img_files,'output',lang='eng',config='hocr') 7 #text = pytesseract.image_to_string(im) 8 #if os.path.isfile('output.html'):AttributeError:模块'pytesseract‘没有属性'run_tesseract’
发布于 2019-12-04 01:40:06
将pytesseract.run_tesseract()替换为pytesseract.pytesseract.run_tesseract()。
在评论中要归功于尼辛。添加这个作为结束它的答案。
https://stackoverflow.com/questions/56286006
复制相似问题