简体   繁体   中英

How to use tesseract in heroku?

I wanna know how to use pytesseract in Heroku, I installed using pip install but when, I put path it gives error. I tried using Build packs too but I can't get path. please help me.

Option 1: with build packs

The build pack executables are in the $INSTALL_DIR directory.

Take a look at this question Heroku buildpacks - installing executables that are used by Python packages to customize your path in a build pack (just clone the build pack git and change your PATH).

Option 2: With custom docker image

Another option is to build your own docker image with based in the official python docker image (ie python:3.8-buster) and install tesseract.

You can use this 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

Once you have this docker image, you can push it to heroku private docker registry and use it to run your dynos.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM