Popen出现“找不到文件”错误(windows/python)

Popen出现“找不到文件”错误(windows/python),python,windows,popen,Python,Windows,Popen,我试图通过subprocess.Popen运行控制台命令,并且每当我运行它时,我都会得到windows File not found错误,即使在运行echo命令时也是如此。 我还在线程模块中使用Popen。这就是问题所在吗?echo不是一个可执行文件,它是cmd.exe内部的一个内部命令。如果要将Popen与内部命令一起使用,请添加关键字参数shell=Trueecho不是可执行文件,它是cmd.exe中的内部命令。如果要将Popen与内部命令一起使用,请添加关键字参数shell=True,而不

我试图通过subprocess.Popen运行控制台命令,并且每当我运行它时,我都会得到windows File not found错误,即使在运行echo命令时也是如此。 我还在线程模块中使用Popen。这就是问题所在吗?

echo不是一个可执行文件,它是cmd.exe内部的一个内部命令。如果要将Popen与内部命令一起使用,请添加关键字参数shell=True

echo不是可执行文件,它是cmd.exe中的内部命令。如果要将Popen与内部命令一起使用,请添加关键字参数shell=True,而不是D:\Program Files\Steam\steamapps\terabytest\sourcesdk\bin\orangebox\bin\vbsp.exe,已使用:/Program Files/Steam/steamapps/terabytest/sourcesdk/bin/orangebox/bin/vbsp.exe

这消除了引号内反斜杠的任何复杂情况。

而不是D:\Program Files\Steam\steamapps\terabytest\sourcesdk\bin\orangebox\bin\vbsp.exe,使用:/Program Files/Steam/steamapps/terabytest/sourcesdk/bin/orangebox/bin/vbsp.exe


这消除了引号内的反斜杠带来的任何复杂问题。

我输入了“D:\Program Files\Steam\steamapps\terabytest\sourcesdk\bin\orangebox\bin\vbsp.exe”,但仍然会出现错误,它对shell=True或shell=False都不起作用为什么?我输入了“D:\Program Files\Steam\steamapps\terabytest\sourcesdk\bin\orangebox\bin\vbsp.exe”,但仍然会出现错误,它对shell=True或shell=False都不起作用为什么?问题的另一个主要来源是路径中的空格。使用参数列表而不是字符串更可靠。试着像Popen[D:/Program Files/Steam/steamapps/terabytest/sourcesdk/bin/orangebox/bin/vbsp.exe,param1,param2]这样做。问题的另一个主要来源是路径中的空白。使用参数列表而不是字符串更可靠。试着像Popen[D:/Program Files/Steam/steamapps/terabytest/sourcesdk/bin/orangebox/bin/vbsp.exe,param1,param2]