# 多进程
# 启动方式一
with multiprocessing.Pool(process_count) as pool:
for i in range(process_count):
pool.apply_async(main)
pool.close()
pool.join()
# 启动方式二
print(f"cpu_count: {multiprocessing.cpu_count()}") # 打印本机cpu个数
pool=multiprocessing.Pool(multiprocessing.cpu_count())
for i in range(6):
pool.apply_async(main)
pool.close()
pool.join()
网友评论