首页 > 解决方案 > 当 Tesseract 路径已设置为本地路径时,如何修复 TesseractNotFoundError?

问题描述

我正在尝试在 Heroku 上部署一个使用 Tesseract 的应用程序。我收到的错误指出:

 pytesseract.pytesseract.TesseractNotFoundError: /usr/local/Cellar/tesseract/4.1.1/bin/tesseract is not installed or it's not in your PATH. See README file for more information.

我花了几个小时试图修复这个错误,但它仍然存在......作为参考,我在我的 OCR python 文件中添加了这行代码。

pytesseract.pytesseract.tesseract_cmd = r'/usr/local/Cellar/tesseract/4.1.1/bin/tesseract'

作为参考,我认为问题可能是 TESSDATA_PREFIX 配置变量。但我不知道配置变量使用哪个路径。我目前的路径是

/usr/local/Cellar/tesseract/4.1.1/bin/tesseract

一切都在 macOS 上,并且 tesseract 是随 Homebrew 一起安装的。

我真的很感激任何帮助!谢谢!

标签: pythonmacosherokupython-tesseract

解决方案


推荐阅读