Child processes created with python multiprocessing module won't print

前端 未结 4 1396
情歌与酒
情歌与酒 2020-11-27 08:12

I have a problem with the code below, and with any code that uses the print function in the child processes. I can\'t see any printed statements, even if I use

4条回答
  •  鱼传尺愫
    2020-11-27 08:54

    The docs for multiprocessing clearly explain why this won't work!

    "Note: Functionality within this package requires that the __main__ method be importable by the children. This is covered in Programming guidelines however it is worth pointing out here. This means that some examples, such as the multiprocessing.Pool examples will not work in the interactive interpreter."

提交回复
热议问题