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

相關文章
相關標籤/搜索