No module named ‘tensorflow.examples‘解决方案

想从tensorflow中导入mnist手写数字数据集,结果报错

from tensorflow.examples.tutorials.mnist import input_data
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

my_mnist = input_data.read_data_sets("MNIST_data_bak/", one_hot=True)


"""
Traceback (most recent call last):
  File "G:/PyCharm/workspace/tensorflow/12_Softmax_regression.py", line 1, in <module>
    from tensorflow.examples.tutorials.mnist import input_data
ModuleNotFoundError: No module named 'tensorflow.examples'
"""

在这里插入图片描述

错误原因

在该环境位置下缺少example文件夹
若您在该位置下有example文件夹,另寻其他方法吧
在这里插入图片描述

解决方案

下载该文件夹examples免费的
放入到上图指定位置处即可
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_41264055/article/details/124922685