subprocess 如何执行多条命令
可以看出: 命令之间用&连接
from icecream import ic
cmd = f'cd ./{lib}'
cmd1 = f'python setup.py install'
# res = subprocess.Popen("dir",shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# ic('stderr', res.stdout.read().decode('gbk')) # 获取错误命令执行之后的结果
# ic(cmd,cmd1)
#
ic(cmd + "&" + cmd1)
res = subprocess.Popen(cmd + "&" + cmd1 + "&" + "cd ../",
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
ic('stderr', res.stderr.read().decode('gbk')) # 获取错误命令执行之后的结果