如何解决我的 .pkl 文件无法加载的问题

How to solve the problem that my .pkl file will not load

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

你能试试下面的代码吗?

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