Python multiprocessing example not working

前端 未结 5 1153
无人及你
无人及你 2020-12-03 02:02

I am trying to learn how to use multiprocessingbut I can\'t get it to work. Here is the code right out of the documentation

from multiprocessin         


        
5条回答
  •  醉梦人生
    2020-12-03 02:32

    My guess is that you are using IDLE to try to run this script. Unfortunately, this example will not run correctly in IDLE. Note the comment at the beginning of the docs:

    Note Functionality within this package requires that the main module 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.

    The __main__ module is not importable by children in IDLE, even if you run the script as a file with IDLE (which is commonly done with F5).

提交回复
热议问题