Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在Windows上使用python MNIST包加载MNIST数据_Python_Package_Mnist - Fatal编程技术网

无法在Windows上使用python MNIST包加载MNIST数据

无法在Windows上使用python MNIST包加载MNIST数据,python,package,mnist,Python,Package,Mnist,正如Github文档中所述,我通过pip在Windows设备上安装了python mnist包,方法是在Anaconda终端中输入以下命令: pip install python-mnist 这对我很管用。但是,当我尝试使用此包加载数据时,如下所示: import mnist train_images = mnist.train_images() 我得到以下错误 AttributeError: module 'mnist' has no attribute 'train_images' 我

正如Github文档中所述,我通过pip在Windows设备上安装了python mnist包,方法是在Anaconda终端中输入以下命令:

pip install python-mnist
这对我很管用。但是,当我尝试使用此包加载数据时,如下所示:

import mnist
train_images = mnist.train_images()
我得到以下错误

AttributeError: module 'mnist' has no attribute 'train_images'
我对用python安装软件包还很陌生,对于为什么会发生这种情况,我一无所知。我一直在寻找“mnist”具有的其他属性,发现通过转到mnist.mnist,我找到了一个名为“train_images”的模块。但是,将代码更改为

import mnist
mnist.MNIST.train_images()

仍然给出相同的错误。如果您能提供有关如何修复此错误的任何帮助,我将不胜感激。

如文档所示,您首先需要从web下载数据(其中有4个存档:),然后运行:

from mnist import MNIST
mndata = MNIST('./dir_with_mnist_data_files')
images, labels = mndata.load_training()

我将从
pip show python mnist
开始检查
mnist.py
是否包含
train\u图像