在 python 中配置多处理以使用 forkserver

Configure Multiprocessing in python to use forkserver

如何配置多处理 in Windows 以使用 'forkserver' 方法? 每当我启动 IPython 控制台并输入:

import multiprocessing
multiprocessing.set_start_method('forkserver')

错误:

ValueError: cannot find context for 'forkserver'

发生。

forkserver 仅在 Python 3.4+ 中可用,并且仅在某些 Unix 平台上可用(不在 Windows 上)。

来自documentation

forkserver

Available on Unix platforms which support passing file descriptors over Unix pipes.

版本 3.4 中的更改: 一些 unix 添加了 [...] forkserver 平台.

forkserver 在 Windows 上不可用的原因是它依赖于 fork(), and there is no fork() on Windows. For more information, see How can I start a sub-process in Windows?