tensorflow2.3.1无法导入mnist数据集

Pycharm tensorflow2.3.1无法导入mnist数据集,程序运行报错No module named tensorflow.examples.tutorials.mnist

from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets ( 'E:/pythonProject/python37/Lib/site-packages/tensorflow/examples/tutorials/mnist/MNIST_data', one_hot=True)

报错原因是因为tensorflow2.3.1没有tutorials 文件 首先需要下载
tutorials下载链接:
tutorials
将下载好的文件解压到tensorflow/examples
如果原先有数据集的先卸载掉,因为这个代码会自动帮你下载,原先有数据集的运行就会报错。
运行代码:
结果如图

Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
Extracting E:/pythonProject/python37/Lib/site-packages/tensorflow/examples/tutorials/mnist/MNIST_data\train-images-idx3-ubyte.gz
Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.
Extracting E:/pythonProject/python37/Lib/site-packages/tensorflow/examples/tutorials/mnist/MNIST_data\train-labels-idx1-ubyte.gz
Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
Extracting E:/pythonProject/python37/Lib/site-packages/tensorflow/examples/tutorials/mnist/MNIST_data\t10k-images-idx3-ubyte.gz
Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
Extracting E:/pythonProject/python37/Lib/site-packages/tensorflow/examples/tutorials/mnist/MNIST_data\t10k-labels-idx1-ubyte.gz

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值