当我尝试并行化 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
问题可能是什么?