在做了大量的在线研究之后,我尝试在heroku部署pytesseract应用程序。
我在Heroku Config vars中添加了TESSDATA_PREFIX=./.apt/usr/share/tesseract-ocr/4.00/tessdata
我在我的heroku构建包中有https://github.com/heroku/heroku-buildpack-apt。
我有Aptfile,其中包括:
tesseract-ocr
tesseract-ocr-eng我有过
pytesseract.tesseract_cmd = '/app/.apt/usr/bin/tesseract'在我的密码里。
我正在将烧瓶API部署到heroku,所以我的Procfile是:web: gunicorn app:app
heroku日志中的错误:
2022-11-16T04:22:39.262113+00:00 app[web.1]: text = pytesseract.image_to_string(img, config="--psm 6")
2022-11-16T04:22:39.262115+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pytesseract/pytesseract.py", line 423, in image_to_string
2022-11-16T04:22:39.262116+00:00 app[web.1]: return {
2022-11-16T04:22:39.262117+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pytesseract/pytesseract.py", line 426, in <lambda>
2022-11-16T04:22:39.262117+00:00 app[web.1]: Output.STRING: lambda: run_and_get_output(*args),
2022-11-16T04:22:39.262117+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pytesseract/pytesseract.py", line 288, in run_and_get_output
2022-11-16T04:22:39.262118+00:00 app[web.1]: run_tesseract(**kwargs)
2022-11-16T04:22:39.262118+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pytesseract/pytesseract.py", line 264, in run_tesseract
2022-11-16T04:22:39.262119+00:00 app[web.1]: raise TesseractError(proc.returncode, get_errors(error_string))
2022-11-16T04:22:39.262121+00:00 app[web.1]: pytesseract.pytesseract.TesseractError: (127, '/app/.apt/usr/bin/tesseract: error while loading shared libraries: libarchive.so.13: cannot open shared object file: No such file or directory')我错过了什么或者我该怎么解决这个问题?
发布于 2022-11-16 14:59:11
错误消息表示缺少库:
error while loading shared libraries: libarchive.so.13: cannot open shared object file: No such file or directoryapt构建包不执行依赖关系解析,因此您可能必须显式地包含传递依赖项。
您可以搜索https://packages.ubuntu.com以查看哪些包包含丢失的文件。确保Ubuntu主版本与您正在使用的Heroku堆栈相匹配,例如,对于Heroku 22,您需要查看Ubuntu22.04LTS (Jammy)的包。
在本例中,套餐包含libarchive.so.13。将其添加到您的Aptfile、提交和重新部署中。如果发现其他缺少的依赖项,请重复此过程。
https://stackoverflow.com/questions/74455213
复制相似问题