当我尝试对python代码进行并行化时,我得到一个断言错误。这是代码:
check = Parallel(n_jobs=ncpu)(delayed(removeident)(h) for h in splitframe)
单独地,splitframe中的每个元素(h)与 removeident 的函数很好地合作,removeident(h)
产生预期的结果。
错误消息在控制台上:
AssertionError: _ _main_ _
Traceback (most recent call last):
File "<string>"; line 1, in <module>
File"C:\Python27\lib\multiprocessing\forking.py"; line 380, in main prepare (preparation_data)
File"C:\Python27\lib\multiprocessing\forking.py"; line 488, in prepare assert main_name not in sys.modules, main_name
问题是什么?