다음 명령으로 bash에서 pw.x를 실행하고 싶습니다 : mpirun -np 4 pw.x < python 스크립트를 통해 input.in. 나는이 사용 :파이썬 스크립트에서 mpirun -np 사용
from subprocess import Popen, PIPE
process = Popen("mpirun -np 4 pw.x", shell=False, universal_newlines=True,
stdin=PIPE, stdout=PIPE, stderr=PIPE)
output, error = process.communicate();
print (output);
를하지만 나에게이 오류 제공 :
Original exception was:
Traceback (most recent call last):
File "test.py", line 6, in <module>
stdin=PIPE, stdout=PIPE, stderr=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'mpirun -np 4 pw.x': 'mpirun -np 4 pw.x'
가 어떻게 파이썬 스크립트에서 "mpirun이 -np ..."를 사용할 수 있습니까?
https://docs.python.org/2/library/subprocess.html#popen-constructor 시도가 : 명령과 패스를 분할 그것은'Popen'에 대한 목록으로 – Pavel