python - 当 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 一起安装的。
我真的很感激任何帮助!谢谢!
解决方案
推荐阅读
- javascript - 设置函数构造函数原型(示例)
- accelerometer - ADXL345数字加速度计中的寄存器地址
- r - 如何在 R markdown 中为自定义块编号
- c++ - aws lambda c++ 运行时段错误(但在本地工作)
- python - django 频道在本地工作,但在服务器上失败
- javascript - 如何使用 javascript 的正则表达式从字符串中获取 html 标签
- javascript - Stencil js - requestAnimationFrame 不会出现在所有组件中
- c++ - 遇到换行符时使用 getline 退出循环
- php - 如何组合两个(或更多)preg_replace - PHP
- python - 如何“去串化”腌制对象?