Python tensorflow初学者教程-读取数据集失败

Python tensorflow初学者教程-读取数据集失败,python,numpy,tensorflow,mnist,Python,Numpy,Tensorflow,Mnist,我正在尝试在Linux上运行。我安装了gcc,cython,numpy,six 我可以导入数据,但解包时似乎出现了某种问题 有人能帮忙吗 Python 2.7.3(默认,2015年6月22日,19:43:34) [GCC 4.6.3]关于linux2 有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。 >>>导入g3doc.tutorials.mnist.input_数据作为输入_数据 >>>mnist=输入数据。读取数据集(“mnist\u data/”,one\u hot=T

我正在尝试在Linux上运行。我安装了
gcc
cython
numpy
six

我可以导入数据,但解包时似乎出现了某种问题

有人能帮忙吗


Python 2.7.3(默认,2015年6月22日,19:43:34)
[GCC 4.6.3]关于linux2
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>导入g3doc.tutorials.mnist.input_数据作为输入_数据
>>>mnist=输入数据。读取数据集(“mnist\u data/”,one\u hot=True)
已成功下载train-images-idx3-ubyte.gz 9912422字节。
提取MNIST_数据/train-images-idx3-ubyte.gz
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“g3doc/tutorials/mnist/input_data.py”,第175行,在读取数据集中
列车图像=提取图像(本地图像文件)
文件“g3doc/tutorials/mnist/input_data.py”,第60行,在extract_images中
buf=bytestream.read(行*cols*num_图像)
文件“/usr/lib/python2.7/gzip.py”,第263行,已读
chunk=self.extrabuf[offset:offset+size]
TypeError:只能将整数标量数组转换为标量索引
>>>mnist=输入数据。读取数据集(“mnist\u data/”,one\u hot=True)
提取MNIST_数据/train-images-idx3-ubyte.gz
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“g3doc/tutorials/mnist/input_data.py”,第175行,在读取数据集中
列车图像=提取图像(本地图像文件)
文件“g3doc/tutorials/mnist/input_data.py”,第60行,在extract_images中
buf=bytestream.read(行*cols*num_图像)
文件“/usr/lib/python2.7/gzip.py”,第263行,已读
chunk=self.extrabuf\[偏移量:偏移量+大小]
TypeError:只能将整数标量数组转换为标量索引


这似乎是最新版本的Numpy的一个问题。为了索引的目的,将单个元素数组视为标量是错误的

我已对上游TensorFlow代码进行了相关更改,但同时您可以将(L45)编辑为以下内容(在行尾添加
[0]
):


这似乎是最新版本Numpy的一个问题。为了索引的目的,将单个元素数组视为标量是错误的

我已对上游TensorFlow代码进行了相关更改,但同时您可以将(L45)编辑为以下内容(在行尾添加
[0]
):


感谢提出此问题-修复现在处于上游:另请参阅:感谢提出此问题-修复现在处于上游:另请参阅:感谢查看此问题!但是当我攻击L60时,我在第62行得到了一个类似的回溯,然后当我攻击L62时,我在gzip.py的L263中得到了类似的回溯。我是否应该从上游提取并尝试它?是的-我们修复了
\u read32()
以返回int而不是数组,这将为您解决问题。再次感谢您的报道!我更新了答案,以显示正确的修复方案——为了子孙后代——但从上游拉动可能仍然是一条路要走。感谢您的关注!但是当我攻击L60时,我在第62行得到了一个类似的回溯,然后当我攻击L62时,我在gzip.py的L263中得到了类似的回溯。我是否应该从上游提取并尝试它?是的-我们修复了
\u read32()
以返回int而不是数组,这将为您解决问题。再次感谢您的报道!我更新了答案,以显示正确的解决方案——为子孙后代——但从上游拉动可能仍然是一条路要走。
Python 2.7.3 (default, Jun 22 2015, 19:43:34)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.   
>>> import g3doc.tutorials.mnist.input_data as input_data
>>> mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
Extracting MNIST_data/train-images-idx3-ubyte.gz
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "g3doc/tutorials/mnist/input_data.py", line 175, in read_data_sets
    train_images = extract_images(local_file)
  File "g3doc/tutorials/mnist/input_data.py", line 60, in extract_images
    buf = bytestream.read(rows * cols * num_images)
  File "/usr/lib/python2.7/gzip.py", line 263, in read
    chunk = self.extrabuf[offset: offset + size]
TypeError: only integer scalar arrays can be converted to a scalar index
>>> mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
Extracting MNIST_data/train-images-idx3-ubyte.gz
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "g3doc/tutorials/mnist/input_data.py", line 175, in read_data_sets
    train_images = extract_images(local_file)
  File "g3doc/tutorials/mnist/input_data.py", line 60, in extract_images
    buf = bytestream.read(rows * cols * num_images)
  File "/usr/lib/python2.7/gzip.py", line 263, in read
    chunk = self.extrabuf\[offset: offset + size]
TypeError: only integer scalar arrays can be converted to a scalar index
return numpy.frombuffer(bytestream.read(4), dtype=dt)[0]