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检查语句里,如果不在,放在里面就可以了