호출이 오류는 하위 프로세스 모든 하위 프로세스 호출 발생파이썬 :</p> <pre><code>import subprocess subprocess.check_output(['echo', 'hello']) </code></pre> <p>이 오류가 발생합니다 : "FileNotFoundError"모든 하위 프로세스에 윈도우 7, 파이썬 3.5.1를 사용
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
subprocess.check_output(['echo', 'hello'])
File "D:\Programs\Python 3.5.1\lib\subprocess.py", line 629, in check_output
**kwargs).stdout
File "D:\Programs\Python 3.5.1\lib\subprocess.py", line 696, in run
with Popen(*popenargs, **kwargs) as process:
File "D:\Programs\Python 3.5.1\lib\subprocess.py", line 950, in __init__
restore_signals, start_new_session)
File "D:\Programs\Python 3.5.1\lib\subprocess.py", line 1220, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
.run, subprocess.call 및 subproccess.Popen. 같은 오류가 사용하는 어떤 명령에 관계없이 발생합니다
subprocess.check_output(['['D:\path\to\exe\program.exe', 'argument'])
FileNotFoundError: [WinError 2] The system cannot find the file specified
지금까지 명령이 존재하지 않는 경로를 실행하려고 할 때 나는이 오류가 일반적으로 발생 말할 수 있지만,이 발생할 왜 내가 확인할 수 이 경우.
바이너리 'echo'를 찾지 못했습니다. 경로 해석 메커니즘을 원하면'shell = True'를 설정해야합니다. –
@WillemVanOnsem 그 문제를 해결하는 것 같습니다. 고맙습니다 –