1.非阻塞模式运行程序
在Python中,利用subprocess中的Popen可以实现非阻塞模式
当实例化Popen对象时
支持两种模式:
传入参数shell = True时,此时command应该是一个字符串:command = ‘python server.py’
当shell = False(default)时,command必须传入一个列表:command = [‘python’, ‘server.py’],
否则会报下面异常:OSError: [Errno 2] No such file or directory,我们的后台服务一般不在shell上运行
2.阻塞模式运行程序
os.system(cmd)是阻塞模式的其中一种方法符串形式的命令,这是一些区别