时报错 raise AttributeError(attr + " not found")

时间:2025-02-11 17:04:09
  1. 问题:我用python3 的() 时报错。错误信息如下代码,
  2. 错误日志:
Traceback (most recent call last):
  File "./", line 179, in main
    train_dataset = (save_traind)
  File "/anaconda3-5.0.1/lib/python3.6/site-packages/scipy/sparse/", line 244, in __setitem__
    if (isintlike(i) and isintlike(j) and 0 <= i < [0]
  File "/anaconda3-5.0.1/lib/python3.6/site-packages/scipy/sparse/", line 576, in __getattr__
    raise AttributeError(attr + " not found")
AttributeError: shape not found

  1. 找到了对策:原来是dump 的时候需要加参数 protocol=0
  2. 具体的:
abc_file = list(XXX)
with open('abc_asve.pkl','wb') as sf:
  (abc_file, sf, protocol=0)
with open('abc_save.pkl', 'rb') as rf:
  abc_read = (sf)

Done!

参考 :
/joblib/joblib/issues/177