import numpy
data = numpy.load('y_train.p')
执行上述代码会出现以下错误提示:
data = numpy.load('y_train.p')
File "D:\Python37\lib\site-packages\numpy\lib\npyio.py", line 457, in load
raise ValueError("Cannot load file containing pickled data "
ValueError: Cannot load file containing pickled data when allow_pickle=False
解决方法:
import numpy
data = numpy.load('y_train.p', encoding='bytes', allow_pickle=True)