简体   繁体   English

如何同时运行多个python文件?

[英]How to run multiple python files simultaneously?

I have python files (named in same way) in different folders.我在不同的文件夹中有 python 文件(以相同的方式命名)。 I want to run all python files at the same time with one script, any of the terminals (of the executed files) should not to be closed when the new terminal is opened.我想用一个脚本同时运行所有 python 文件,当打开新终端时,不应关闭任何终端(已执行的文件)。 Which means, I want them to run simultaneously, each in a new/different terminal .这意味着,我希望它们同时运行,每个都在一个新的/不同的终端中 What kind of script could do this?什么样的脚本可以做到这一点?

SOLVED解决了

I just had to use:我只需要使用:

subprocess.Popen("python pathtoeachfile//file.py", creationflags=subprocess.CREATE_NEW_CONSOLE) subprocess.Popen("python pathtoeachfile//file.py", creationflags=subprocess.CREATE_NEW_CONSOLE)

and loop over my files.并循环我的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM