I am running a simple "Hello World" program on Windows 7 64 bit with the following specifications:
Python 3.4.3 | Anaconda 2.3.0 (64-bit) | [MSC v.1600 64 bit (AMD64)] IPython 4.0.0
The program:
from multiprocessing import Process, freeze_support
def f():
print ('hello world!')
if __name__ == '__main__':
#freeze_support()
Process(target=f).start()
gives the following error:
[I 15:02:23.855 NotebookApp] Saving file at /uhc/FeatureContributionToK-meansClu
sterWithPC.ipynb
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:Anaconda3libmultiprocessingspawn.py", line 106, in spawn_main
exitcode = _main(fd)
File "C:Anaconda3libmultiprocessingspawn.py", line 116, in _main
self = pickle.load(from_parent)
AttributeError: Can't get attribute 'f' on module '__main__' (built-in)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…