成功解决ForkingPickler(file, protocol).dump(obj) TypeError: can't pickle Environment objects

简介: 成功解决ForkingPickler(file, protocol).dump(obj) TypeError: can't pickle Environment objects

解决问题


image.png


ForkingPickler(file, protocol).dump(obj)

TypeError: can't pickle Environment objects




解决思路


类型错误:无法pickle环境对象





解决方法(三种)


T1、将队列移动到self,而不是作为函数包和send的参数。


参考国外网友解释:TypeError: can't pickle _thread.lock objects

image.png



T2、multiprocessing.Manager().Queue() instead of multiprocessing.Queue

参考国外网友解释:multiprocessing.Pool - PicklingError: Can't pickle <type 'thread.lock'>: attribute lookup thread.lock failed


image.png


T3、寻求更好的办法ing







相关文章
|
8月前
|
JSON 数据格式
解决报错TypeError: Converting circular structure to JSON --> starting at object with constructor
解决报错TypeError: Converting circular structure to JSON --> starting at object with constructor
|
6月前
|
开发者 Python
【Python】已解决:TypeError: descriptor ‘index‘ for ‘list‘ objects doesn‘t apply to a ‘str‘ object
【Python】已解决:TypeError: descriptor ‘index‘ for ‘list‘ objects doesn‘t apply to a ‘str‘ object
171 0
|
8月前
报错:cannot read properties of undefined(reading ‘forEach‘)
报错:cannot read properties of undefined(reading ‘forEach‘)
677 1
报错:cannot read properties of undefined(reading ‘forEach‘)
|
8月前
【报错】 “TypeError: Cannot read properties of undefined (reading ‘split‘)“
【报错】 “TypeError: Cannot read properties of undefined (reading ‘split‘)“
1012 0
|
8月前
|
Linux Windows Python
ForkingPickler(file, protocol).dump(obj) TypeError: can‘t pickle Environment objects
ForkingPickler(file, protocol).dump(obj) TypeError: can‘t pickle Environment objects
172 0
|
8月前
|
JavaScript
【报错】:Cannot read properties of undefined (reading ‘prototype‘)
【报错】:Cannot read properties of undefined (reading ‘prototype‘)
453 0
|
8月前
|
JavaScript
Cannot read properties of undefined (reading ‘install‘) TypeError: Cannot read properties of……
Cannot read properties of undefined (reading ‘install‘) TypeError: Cannot read properties of……
|
JavaScript 前端开发
element-plus 报错 TypeError: Cannot read properties of undefined (reading ‘setCheckedKeys‘)
element-plus 报错 TypeError: Cannot read properties of undefined (reading ‘setCheckedKeys‘)
467 0
|
TensorFlow 算法框架/工具 Python
成功解决File "frozen importlib._bootstrap", line 219, in _call_with_frames_removed ImportError: DLL lo
成功解决File "frozen importlib._bootstrap", line 219, in _call_with_frames_removed ImportError: DLL lo
成功解决File "frozen importlib._bootstrap", line 219, in _call_with_frames_removed ImportError: DLL lo
报错AttributeError: Can‘t pickle local object ‘Worker.__init__.<locals>.<lambda>‘解决办法
报错AttributeError: Can‘t pickle local object ‘Worker.__init__.<locals>.<lambda>‘解决办法
621 0