我在 python 中使用 tesseract 包时出错

我正在尝试使用 pytesseract OCR 读取支票中的文本。我已经安装了此任务所需的 Python 包,例如 pip install pytesseract。


但是,当我尝试使用该包读取文件时,出现以下错误:


 pytesseract.image_to_string(im,)

Traceback (most recent call last):


  File "<ipython-input-17-d7d9f430493b>", line 1, in <module>

    pytesseract.image_to_string(im,)


  File "C:\Users\BRIGHT\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 294, in image_to_string

    return run_and_get_output(*args)


  File "C:\Users\BRIGHT\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 202, in run_and_get_output

    run_tesseract(**kwargs)


  File "C:\Users\BRIGHT\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 172, in run_tesseract

    raise TesseractNotFoundError()


TesseractNotFoundError: tesseract is not installed or it's not in your path

这个错误没有意义,因为我实际上导入了包而没有出现任何错误。但是当我尝试使用它时,我得到了错误。


这是我的代码:


from PIL import Image

import pytesseract


im=Image.open('BritishChequeAnnotated.jpg')

text=pytesseract.image_to_string(im,)


拉莫斯之舞
浏览 393回答 2
2回答

函数式编程

您需要安装teseract可执行文件并将路径包含在程序中,然后它就不会出现任何错误
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python