我想知道如何在Heroku中使用pytesseract,我使用pip install安装了pytesseract,但是当我放入path时,它给出了错误。我也尝试过使用构建包,但无法获取路径。请帮帮我。
发布于 2020-10-19 22:13:08
选项1:使用构建包
构建包可执行文件位于$INSTALL_DIR目录中。
看看这个问题Heroku buildpacks - installing executables that are used by Python packages,在构建包中自定义路径(只需克隆构建包git并更改路径)。
选项2:使用自定义docker镜像
另一种选择是使用官方的python docker镜像(即python:3.8-buster)构建自己的docker镜像,然后安装tesseract。
您可以使用此dockerfile:
FROM python:3.8-buster
RUN apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:alex-p/tesseract-ocr
RUN apt-get update && apt-get install -y tesseract-ocr-all 
RUN mkdir /home/work
WORKDIR /home/work一旦你有了这个docker镜像,你就可以将它推送到heroku私有docker注册表,并使用它来运行你的dynos。
https://stackoverflow.com/questions/64426886
复制相似问题