在跑一本drl书中的代码遇到这个问题,到书的github页面看到别人也有类似的问题
搬运答案
Had the same issue, this is because multiprocessing does not work natively inside a Jupyter notebook. For details see this StackOverflow discussion (specifically Eden Trainor’s answer):
有同样的问题,这是因为多处理在 Jupyter 笔记本中无法本机工作。有关详细信息,请参阅此 StackOverflow 讨论(特别是 Eden Trainor 的回答):
https://stackoverflow.com/questions/48846085/python-multiprocessing-within-jupyter-notebook
Apparently someone has created a similar library to multiprocessing called multiprocess which works inside jupyter notebooks. However, I suggest the authors (@azai91) either put a !pip install multiprocess in the notebook for this, or add a comment saying to run it from an IDE like Spyder. Since the multiprocess library has its own problems (had to re-import numpy inside the process) probably would go for the latter option.
显然,有人创建了一个与多处理类似的库,称为多进程,该库在 jupyter 笔记本中工作。但是,我建议作者 () 为此在笔记本中放置一个 !pip install 多进程,或者添加一条注释,说从 Spyder 等 IDE 运行它。由于多进程库有其自身的问题(必须在进程中重新导入numpy),因此可能会选择后一种选择。
主要是进程改线程
或者专门下一个multiprocess库 但会有些小问题