问题
I made a Python script that does OCR, and then I recycled the script and made a web app using Flask. The web app and its libraries are in a virtualenv, but the app is using the Tesseract OCR that was installed in the OS (Windows). I've been testing it from the local server. Now it is time for deployment, and I don't know how to install Tesseract in the venv or if it is possible to install it on a server. I don't know if what I'm saying makes sense, but I'm very lost and I will really appreciate any help with this matter.
Thank you in advance.
回答1:
This would depend on the operating system of the server which you're deploying to. If you're running in docker, this is the OS of the base image.
Most likely you'll install from from a pre-built binary.
Once you've installed, locate the binary. On linux use the command:
which tesseract
this will output something like:
/usr/bin/tesseract
Then in your application code, as per the usage instructions point pytesseract
to this binary:
pytesseract.pytesseract.tesseract_cmd = r'/usr/bin/tesseract'
来源:https://stackoverflow.com/questions/60740448/is-there-any-way-to-install-tesseract-ocr-in-a-venv-web-server