问题描述
如何腌制包含lambda的python对象?
How can I pickle a python object which contains lambdas?
Can't pickle local object 'BaseDiscretizer.__init__.<locals>.<lambda>'
是我尝试腌制 https://github上的错误.com/marcotcr/lime/blob/97a1e2d7c1adf7b0c4f0d3b3e9b15f6197b75c5d/lime/discretize.py 腌制 https://github.com/marcotcr/lime/blob/2703bcdcddd135947fe74e99cc270aa4fac3263a/lime/lime_tabular.py#L88 LimeTabularExplainer
is the error I get when trying to pickle https://github.com/marcotcr/lime/blob/97a1e2d7c1adf7b0c4f0d3b3e9b15f6197b75c5d/lime/discretize.py when pickling the https://github.com/marcotcr/lime/blob/2703bcdcddd135947fe74e99cc270aa4fac3263a/lime/lime_tabular.py#L88 LimeTabularExplainer
推荐答案
标准pickle
模块无法序列化lambda,但是有一个名为 dill
支持它们.
The standard pickle
module cannot serialize lambdas, but there is a third party package called dill
which supports them.
这篇关于带有lambdas的python泡菜对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!