python之ProcessPoolExecutor

ProcessPoolExecutor使用上基本与ThreadPoolExecutor一致
不过在windows上使用,有个问题需要注意。使用不当会出现如下错误
File "...\lib\multiprocessing\spawn.py", line 137, in _check_not_importing_main
    is not going to be frozen to produce an executable.''')
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

 出现这个需要检查多进程代码的调用,看看是不是在

if __name__ == '__main__':
    main()

 name检查语句里,如果不在,放在里面就可以了

 

posted on 2018-10-05 09:38  FlowingCloud  阅读(1792)  评论(0编辑  收藏  举报

导航