Is there any way to install Tesseract OCR in a venv/web server?

帅比萌擦擦* 提交于 2021-01-28 04:02:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!