无法加载.pkl文件

时间:2015-12-15 09:04:35

标签: python python-2.7 machine-learning pickle

我是python的新手,所以要腌制文件。当我遇到这个问题时,我一直在关于Udacity的机器学习课程。这是我的代码:

import pickle 
enron_data = pickle.load(open(filename, "r"))

通过第5课我们必须从python中的.pkl文件加载Enron Dataset,但我不断收到以下错误:

as@LENOVO:~/Desktop/ud120-projects$ python datasets_questions/explore_enron_data.py
Traceback (most recent call last):
  File "datasets_questions/explore_enron_data.py", line 20, in <module>
    enron_data = pickle.load(open("/home/as/Desktop/ud120-projects/final_project/final_project_dataset.pkl", "r"))
  File "/usr/lib/python2.7/pickle.py", line 1378, in load
    return Unpickler(file).load()
  File "/usr/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/usr/lib/python2.7/pickle.py", line 966, in load_string
    raise ValueError, "insecure string pickle"

0 个答案:

没有答案