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.

 出现这个须要检查多进程代码的调用,看看是否是在python

if __name__ == '__main__':
    main()

 name检查语句里,若是不在,放在里面就能够了bootstrap

相关文章
相关标签/搜索