【发布时间】:2022-05-10 21:38:20
【问题描述】:
我想将我的 tesseract 应用程序部署到 heroku,但它总是“无法找到包 tesseract-ocr”并且无法部署它。
我的步骤:
- 将 pytesseract.pytesseract.tesseract_cmd = ‘/app/.apt/usr/bin/tesseract’ 写入我的应用程序代码
- 获取 requirements.txt、procfile 和 Aptfile,包括 tesseract-ocr tesseract-ocr-engli>
- 添加Buildpack https://github.com/heroku/heroku-buildpack-apt(我是直接在设置中添加的),我也试过这个buildpack:https://github.com/matteotiziano/heroku-buildpack-tesseract
- 添加 Tesseract 配置文件:TESSDATA_PREFIX = ./.apt/usr/share/tesseract-ocr/4.00/tessdata (这里应该是 tesseract 的正确路径,但 'find -iname tessdata' 对我不起作用。我直接在 heroku 网站上使用运行控制台,我也在我的电脑上尝试过heroku run bash -a myappname 也没有显示任何内容。) 我在“Key”下添加了“TESSDATA_PREFIX”,在“Value”下添加了“./.apt/usr/share/tesseract-ocr/4.00/tessdata”。另外尝试了:/app/.apt/usr/share/tesseract-ocr/4.00/tessdata 和 /app/.apt/usr/share/tesseract-ocr/tessdata)
- 然后我再次部署它(我在添加 Buildpack 等之前已经部署了它)
这是我得到的错误:
E: Unable to locate package tesseract-ocr
! Push rejected, failed to compile Apt app.
! Push failed
非常感谢您的帮助!
更多信息:我的应用在 postman 本地运行,所以我认为这不是编码问题。
【问题讨论】:
标签: flask heroku tesseract python-tesseract