[Python]Running multiprocessing
Posted jbite9057
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Python]Running multiprocessing相关的知识,希望对你有一定的参考价值。
import multiprocessing as mp import time def name_and_time(name,num): print(f"Hello {name}, current time is {time.time()} ({num})") print(‘Sleeping for 2 seconds ...‘) time.sleep(2) print("After sleeping ... exiting function") if __name__ == ‘__main__‘: process_list = list() for i in range(100): process = mp.Process(target=name_and_time,args=(‘Andrei‘,i)) process_list.append(process) for p in process_list: p.start() for p in process_list: p.join() print(‘Other instructions of the main module....‘) print(‘End of Script‘)
以上是关于[Python]Running multiprocessing的主要内容,如果未能解决你的问题,请参考以下文章
protobuf requires Python ‘>=3.7‘ but the running Python is 3.6.5的解决方法