【ipython錯誤】
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "d:\software\python\lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "d:\software\python\lib\multiprocessing\spawn.py", line 115, in _main
self = reduction.pickle.load(from_parent)
AttributeError: Can't get attribute 'fun' on <module '__main__' (built-in)>
這是父進程
parent a: 1
本地IDE錯誤
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
【解決辦法】
將執行代碼放在 if __name__ == "__main__":后,
詳見上篇隨筆https://www.cnblogs.com/longyuu/p/14247847.html