zlib.error:解压缩时出错-3:无效距离代码

时间:2016-03-17 08:26:45

标签: python python-2.7 tensorflow

我试图使用mnist数据集使用Tensorflow创建模型。 我已经正确安装了Tensorflow,然后当我尝试使用命令创建模型时。

python convolutional.py

我在控制台上收到错误消息:

Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.
Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
Extracting data/train-images-idx3-ubyte.gz
Traceback (most recent call last):
  File "convolutional.py", line 316, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/default/_app.py", line 30, in run
    sys.exit(main(sys.argv))
  File "convolutional.py", line 128, in main
    train_data = extract_data(train_data_filename, 60000)
  File "convolutional.py", line 75, in extract_data
    buf = bytestream.read(IMAGE_SIZE * IMAGE_SIZE * num_images)
  File "/usr/lib/python2.7/gzip.py", line 261, in read
    self._read(readsize)
  File "/usr/lib/python2.7/gzip.py", line 312, in _read
    uncompress = self.decompress.decompress(buf)
zlib.error: Error -3 while decompressing: invalid block type

我正在使用安装在14.04 Ubuntu操作系统中的Python2.7。

1 个答案:

答案 0 :(得分:2)

问题的根源似乎是无效的数据文件:“data / train-images-idx3-ubyte.gz”。 有没有办法获得该文件的新副本? 请使用以下shell命令验证文件的新副本:

gunzip -t  data/train-images-idx3-ubyte.gz

一旦上述测试将返回gz文件有效的答案,请执行脚本:

python convolutional.py