Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么Tesseract psm config在运行python子进程时出现错误_Python_Python 3.x_Subprocess_Tesseract - Fatal编程技术网

为什么Tesseract psm config在运行python子进程时出现错误

为什么Tesseract psm config在运行python子进程时出现错误,python,python-3.x,subprocess,tesseract,Python,Python 3.x,Subprocess,Tesseract,我尝试使用以下代码通过python子进程运行tesseract: import subprocess extract = subprocess.run(['tesseract', 'imCropped.png', 'stdout', '-l', 'eng', '--psm 6'], capture_output=True, text=True) print(extract.stdout, extract.stderror) 但是,它会抛出以下错误,并且不会运行: 错误,未知的命令行参数'-

我尝试使用以下代码通过python子进程运行tesseract:

import subprocess

extract = subprocess.run(['tesseract', 'imCropped.png', 'stdout', '-l', 'eng', '--psm 6'], capture_output=True, text=True)

print(extract.stdout, extract.stderror)
但是,它会抛出以下错误,并且不会运行:

错误,未知的命令行参数'-psm 6'

当运行其他组合时,例如删除psm设置但保留语言设置,它将运行并给出输出

使用CLI时,以下命令正常运行并提供输出:

tesseract imCropped.png stdout -l eng --psm 6
我做错了什么?通过子流程使用时是否不支持psm配置设置

非常感谢您的帮助。 谢谢


PS:该项目要求我不使用PyteSeract绑定,这对于psm配置很好。

-psm和6是两个独立的参数,因此您应该这样传递它们:'-psm',6'哦,是的!成功了!非常感谢。