首页 > 解决方案 > 如何解决 Tesseract Not Found Error,Anaconda?

问题描述

所以我的 conda 版本是 4.8.3 我是新安装的 tesseract 和 anaconda。使用以下命令安装 tesseract:

`conda install -c conda-forge pytesseract`
`conda install -c conda-forge/label/cf202003 pytesseract `

现在,当我尝试将简单图像运行到 ocr 代码时,出现以下错误

File "C:\Users\user\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 232, in run_tesseract 提高TesseractNotFoundError()

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

标签: pythonpython-tesseract

解决方案


您会看到此错误,因为您的PATH中没有 tesseract 可执行文件。所以你必须包括以下行:

pytesseract.pytesseract.tesseract_cmd = r'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'

您可以在pytesseract的官方文档中看到一个示例。

我编写了默认的tesseract 可执行文件夹,但如果您更改了它,请记住使用<full_path_to_your_tesseract_executable>(如上一个链接中所建议的)。


推荐阅读