Python multiprocessing continuously spawns pythonw.exe processes without doing any actual work

前端 未结 3 1800
广开言路
广开言路 2020-12-06 10:55

I don\'t understand why this simple code

# file: mp.py
from multiprocessing import Process
import sys

def func(x):
    print \'works \', x + 2
    sys.stdou         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-06 11:20

    According to the programming guidelines for multiprocessing, on windows you need to use an if __name__ == '__main__':

提交回复
热议问题