joblib.Load()不起作用

时间:2016-01-04 16:15:05

标签: scikit-learn pickle joblib

我已使用joblib.dump保存我的文件,但它运行正常。现在,我想使用.pkl访问我的joblib.load()文件,但会收到以下错误:

File "/usr/local/lib/python2.7/dist-packages/sklearn/externals/joblib/numpy_pickle.py", line 425, in load
    obj = unpickler.load()
  File "/usr/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/usr/local/lib/python2.7/dist-packages/sklearn/externals/joblib/numpy_pickle.py", line 285, in load_build
    Unpickler.load_build(self)
  File "/usr/lib/python2.7/pickle.py", line 1226, in load_build
    for k, v in state.iteritems():
AttributeError: 'tuple' object has no attribute 'iteritems'

我无法弄清楚为什么会这样。

1 个答案:

答案 0 :(得分:0)

看起来你的引用(变量)它是一个元组。

我曾遇到过类似的问题,问题是我在行尾有一个“,”。这导致python将赋值解释为元组。也许这就是你的问题?