小编Dwi*_*ter的帖子

“ascii”编解码器无法解码位置 6 中的字节 0x8b:序号不在范围内 (128)

我正在尝试使用张量流编写 cnn 代码,但我不断出现此错误:

UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-20-a02172d91c0c> in <module>()
     39 # Load all the data batches.
     40 for i in range(5):
---> 41     data_batch = unpickle( 'data_batch_' + str(i + 1))
     42 
     43     train_data = np.append(train_data, data_batch[b'data'])

<ipython-input-20-a02172d91c0c> in unpickle(file)
     27     import pickle
     28     with open(file, 'rb') as fo:
---> 29         dict = pickle.load(fo)
     30         dict = dict.encode('ascii', 'ignore')
     31     return dict

UnicodeDecodeError: 'ascii' codec can't decode byte 0x8b in position 6: ordinal not in range(128)
Run Code Online (Sandbox Code Playgroud)

我不知道该怎么办,我已经尝试了一切,但仍然遇到同样的错误。这是我的代码: …

python pickle tensorflow

3
推荐指数
1
解决办法
3508
查看次数

标签 统计

pickle ×1

python ×1

tensorflow ×1