【问题标题】:How to solve the problem that my .pkl file will not load如何解决我的 .pkl 文件无法加载的问题
【发布时间】:2021-11-27 05:55:28
【问题描述】:
filename = "/content/classifier_10class.pkl"
infile = open(filename,'rb')
new_dict = pickle.load(infile)
infile.close()

EOFError                                  Traceback (most recent call last)

<ipython-input-57-36f3a6bd7cfb> in <module>()

      1 filename = "/content/classifier_10class.pkl"
      2 infile = open(filename,'rb')
 ---> 3 new_dict = pickle.load(infile)
      4 infile.close()

EOFError: Ran out of input

【问题讨论】:

标签: python pickle


【解决方案1】:

你能试试下面的代码吗?

>>> import pickle
>>> with open('file.pkl', 'rb') as fp:
>>>     data = pickle.load(fp)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-07-21
    • 2018-09-22
    • 2018-10-27
    • 1970-01-01
    • 2012-11-16
    • 1970-01-01
    • 2019-07-17
    相关资源
    最近更新 更多