我使用Python3.6,此代码发生错误
with open('val_image_id2feature.pkl', 'rb') as f:
val_image_id2feature = pickle.load(f)
UnicodeDecodeError:“ ascii”编解码器无法解码位置0的字节0xcc:序数不在范围内(128)
如果我按如下方式添加encoding='latin1'
或encoding='bytes'
,则会出现新问题
with open('val_image_id2feature.pkl', 'rb') as f:
val_image_id2feature = pickle.load(f, encoding='latin1')
_pickle.UnpicklingError:泡菜数据被截断
如何处理?