有没有办法通过Python调用Linux shell命令而不必等待其完成?我已经看到线程在Windows环境中执行此操作,但不适用于Linux(Raspbian)...
subprocess.Popen
应该可以解决问题。
from subprocess import Popen
process = Popen(['sleep', '10'])
print 'Returned immediately!'
您可以使用子流程。普彭
import subprocess
proc = subprocess.Popen('echo "test" > a', shell=True)