我对这个错误感到非常沮丧,我所做的就是从张量流教程中获取代码以进口湿润:
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
但是,当我运行python时:
file"/users/kevinling/desktop/Machine Learning/tensorflow.py",第2行,in 来自tensorflow.examples.tutorials.mnist导入input_dataImporterror:无模块名称示例.tutorials.mnist
当我签入目录时,该文件完美地存在:
目录是:
在此处输入图像描述
input_data.py就像:
input_data.py
只需将您的示例从" tensorflow.py"重命名为其他任何东西,它将起作用。解释器正在尝试从脚本导入必要的文件。
您是否已经安装了TensorFlow?如果没有,请按照其安装说明或简单地使用PIP安装:
pip install tensorflow
现在,请确保您当前是当前在TensorFlow所在的文件夹中,然后尝试运行脚本。
python your_script.py