【问题标题】:how do we use pytesseract in a node.js server我们如何在 node.js 服务器中使用 pytesseract
【发布时间】:2021-09-02 15:02:27
【问题描述】:

我正在使用子进程将图像发送到我的 node.js 服务器中的 python 脚本。 我可以在我的 python 脚本中读取图像,但是一旦我尝试使用 pytesseract.image_to_string 将其转换为文本,我就会收到此错误“错误:引发 TesseractNotFoundError() pytesseract.pytesseract.TesseractNotFoundError: ./Tesseract/tesseract.exe 未安装或不在您的 PATH 中。”。 我已经在我的项目中添加了 tesseract-ocr 文件夹,但是出现了错误。

PS:当我在一个普通的 js 文件中尝试这个时,它工作得很好。但在我的 node.js 服务器中它不起作用!

【问题讨论】:

    标签: javascript python node.js reactjs python-tesseract


    【解决方案1】:

    你是如何安装 tesseract 的?

    python 库似乎正在相对于其相对路径搜索它。

    我建议您通过使用此属性告诉 pytesseract 您的可执行文件所在的位置来修改此行为:

    pytesseract.pytesseract.tesseract_cmd = r'<full_path_to_your_tesseract_executable>'

    在 Usage 下找到 here

    【讨论】:

      猜你喜欢
      • 2013-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      • 2017-03-18
      • 2016-07-07
      相关资源
      最近更新 更多