我在python中使用tesseract包时出错

我在python中使用tesseract包时出错,python,python-tesseract,Python,Python Tesseract,我正在尝试使用pytesseract OCR阅读支票中的文本。我已经安装了此任务所需的python软件包,例如pip install pytesseract 但是,当我尝试使用该包读取文件时,出现以下错误: pytesseract.image_to_string(im, lang='eng') Traceback (most recent call last): File "<ipython-input-17-d7d9f430493b>", line 1, in <mo

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

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

 pytesseract.image_to_string(im, lang='eng')
Traceback (most recent call last):

  File "<ipython-input-17-d7d9f430493b>", line 1, in <module>
    pytesseract.image_to_string(im, lang='eng')

  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

tesseract的文档说明了这一点

#如果路径中没有tesseract可执行文件,请包括以下内容:
pytesseract.pytesseract.tesseract_cmd=r“”

您需要安装teserract可执行文件,并将路径包含到程序中,这样它不会出现任何错误

您确定使用与正在编辑的相同版本运行python文件吗?我看到很多人在anaconda中开发,然后在其他pythonYes中运行。我正在这样做。你在Python中“成功导入”的只是一个包装器。一个连接Python和Tesseract的网桥,您也应该在您的机器上安装它。您必须在pc上安装实际的Tesseract:欢迎使用Stack Overflow。你能用一些示例代码来澄清一下吗?这也是一个很好的主意,学习和阅读。
from PIL import Image
import pytesseract

im=Image.open('BritishChequeAnnotated.jpg')
text=pytesseract.image_to_string(im, lang='eng')
# If you don't have tesseract executable in your PATH, include the following:
pytesseract.pytesseract.tesseract_cmd = r'<full_path_to_your_tesseract_executable>'