【问题标题】:Unable to Execute Tesseract command from python无法从 python 执行 Tesseract 命令
【发布时间】:2017-09-27 16:30:29
【问题描述】:

我正在尝试从 python 代码执行“tesseract abc.tif abc.txt”

subprocess.call(["tesseract abc.tif abc.txt"], shell=True, stderr=subprocess.PIPE)

但其显示 '"tesseract abc.tif abc.txt"' 未被识别为内部或外部命令, 可运行的程序或批处理文件。

subprocess.call(["tesseract"], shell=True, stderr=subprocess.PIPE)

它正在执行上述命令,没有任何错误。 'tesseract abc.tif abc.txt' 我可以从外部命令提示符执行。只有那个命令无法从 python 执行。我正在使用 PYCHARM IDE

【问题讨论】:

  • 你试过用subprocess.call("tesseract abc.tif abc.txt".slit(), shell=False, stderr=subprocess.PIPE)吗?

标签: python pycharm tesseract python-tesseract


【解决方案1】:

我猜,你需要使用:

subprocess.call(["tesseract", "abc.tif", "abc.txt"])

或者,您可以简单地使用:

import os
os.system("tesseract abc.tif abc.txt")

【讨论】:

  • shell=True 必须使用字符串,否则它只会调用列表的第一个元素。第一个参数的上述语法应与shell=False 一起使用
猜你喜欢
  • 2017-07-04
  • 2011-09-15
  • 1970-01-01
  • 2019-08-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-22
相关资源
最近更新 更多