交互运行子进程command.
subprocess.Popen(command.split(),stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
注意: command命令中如果含有空格,必须要用split()函数,否则会报错。
举例:运行“ls -l”
>>> subprocess.Popen("ls -l")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.6/subprocess.py", line 639, in __init__
errread, errwrite)
File "/usr/lib64/python2.6/subprocess.py", line 1228, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory