[英]How can I run multiple python files at the same time in Mac OSX
我一直在搜索,我找到的每個解決方案都是針對 Windows 特定的。 我正在尋找一種同時運行多個 python 程序的方法。 我努力了
導入測試1
導入測試2
我一次只能得到其中一個。 我需要同時運行兩者。
任何幫助表示贊賞!
要並行運行 Python 代碼,請參閱模塊multiprocessing 。
from multiprocessing import Process
def first_import():
import test1
def second_import():
import test2
if __name__ == '__main__':
first_process = Process(target=first_import)
second_process = Process(target=second_import)
first_process.start()
second_process.start()
first_process.join()
second_process.join()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.