linux同时执行多个python脚本的三种方法

1. 命令行执行 python test1.py & python test2.py & python test3.py

2. 创建run.py

import os

os.system("python ./test1.py")
os.system("python ./test2.py")
os.system("python ./test3.py")

执行 python run.py

3. 创建 run.sh

#!/bin/sh
python test1.py >/dev/null 2>&1
python test2.py >/dev/null 2>&1
python test3.py >/dev/null 2>&1

赋予sh脚本可执行权限  chmod -x run.sh

执行 sh run.sh

Supongo que te gusta

Origin blog.csdn.net/qq_36940806/article/details/110206407
Recomendado
Clasificación