问题描述
我制作了一个执行 OCR 的 Python 脚本,然后我回收了该脚本并使用 Flask 制作了一个网络应用程序.Web 应用程序及其库位于 virtualenv 中,但该应用程序使用的是安装在操作系统 (Windows) 中的 Tesseract OCR.我一直在本地服务器上测试它.现在是部署的时候了,我不知道如何在venv中安装Tesseract,也不知道是否可以将其安装在服务器上.我不知道我说的话是否有道理,但我非常迷茫,我将非常感谢您对此事的任何帮助.
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.
提前致谢.
推荐答案
这取决于您要部署到的服务器的操作系统.如果您在 docker 中运行,则这是基础映像的操作系统.
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.
您很可能会从从预构建的二进制文件安装.
安装后,找到二进制文件.在 linux 上使用命令:
Once you've installed, locate the binary. On linux use the command:
which tesseract
这将输出如下内容:
/usr/bin/tesseract
然后在您的应用程序代码中,按照使用说明点pytesseract代码>到这个二进制文件:
Then in your application code, as per the usage instructions point pytesseract
to this binary:
pytesseract.pytesseract.tesseract_cmd = r'/usr/bin/tesseract'
这篇关于有没有办法在 venv/web 服务器中安装 Tesseract OCR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!