求助!使用python multiprocessing时 Can’t get attribute ‘main’ on <module ‘main’ from##
找到好多相似的文章,挨着试了一遍,依旧报错…有无经历过相似问题的朋友指导下!感谢!
具体报错如下
Traceback (most recent call last):
File “D:\python3.7.0\lib\multiprocessing\util.py”, line 265, in _run_finalizers
finalizer()
File “D:\python3.7.0\lib\multiprocessing\util.py”, line 189, in call
res = self._callback(*self._args, **self._kwargs)
File “D:\python3.7.0\lib\multiprocessing\pool.py”, line 581, in _terminate_pool
cls._help_stuff_finish(inqueue, task_handler, len(pool))
File “D:\python3.7.0\lib\multiprocessing\pool.py”, line 568, in _help_stuff_finish
inqueue._reader.recv()
File “D:\python3.7.0\lib\multiprocessing\connection.py”, line 251, in recv
return _ForkingPickler.loads(buf.getbuffer())
AttributeError: Can’t get attribute ‘main’ on <module ‘main’ from ‘c:\Users\asus\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\lib\python\debugpy\main.py’>
部分代码:
if name ==‘main’:
radar_paths = [r’D:\NQ\Radar’,r’D:\NQ\1’]
pool = Pool(2)
for p in range(len(radar_paths)):
print(radar_paths[p])
pool.apply_async(main,args = (p,))
pool.close
pool.join