Pickle incompatibility of numpy arrays between Python 2 and 3

前端 未结 7 1687
遥遥无期
遥遥无期 2020-11-28 01:12

I am trying to load the MNIST dataset linked here in Python 3.2 using this program:

import pickle
import gzip
import numpy


with gzip.open(\'mnist.pkl.gz\',         


        
7条回答
  •  长情又很酷
    2020-11-28 02:07

    If you are getting this error in python3, then, it could be an incompatibility issue between python 2 and python 3, for me the solution was to load with latin1 encoding:

    pickle.load(file, encoding='latin1')
    

提交回复
热议问题