相关疑难解决方法(0)

python:为什么用子进程调用echo返回WindowsError 2?

在我的程序中,我有一个函数runScript():

def runScript():
subprocess.call(['echo', 'hello'])
Run Code Online (Sandbox Code Playgroud)

我在Python文档中看到过很多类似的例子,所以我认为这样可行.但是,当我在程序中调用此函数时,它返回一个WindowsError.

WindowsError: [Error 2] The system cannot find the file specified
Run Code Online (Sandbox Code Playgroud)

为什么会这样?我该如何解决?

python windows subprocess

4
推荐指数
1
解决办法
2927
查看次数

标签 统计

python ×1

subprocess ×1

windows ×1