我在spyder 3.1中成功运行了这段代码:
from multiprocessing import Pool
def f(x):
return x*x
if __name__ == '__main__':
p = Pool(5)
print(p.map(f, [1, 2, 3]))
我通过运行以下命令安装了spyder 3.2.1:
conda install -c spyder-ide spyder
自从安装Spyder以来,上述功能不再适用。我得到一个很长的错误消息,结尾如下:
File "C:\Users\ywu\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 172, in get_preparation_data
main_mod_name = getattr(main_module.__spec__, "name", None)
AttributeError: module '__main__' has no attribute '__spec__'
我正在运行Windows 10,spyder 3.2和IPython。关于我做错了什么想法?
谢谢!