2

I am very frustrated by this error, what I did is getting the code from tensor flow tutorial to import moist:

from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)

However when I run the python shows:

File "/Users/kevinling/Desktop/Machine Learning/tensorflow.py", line 2, in from tensorflow.examples.tutorials.mnist import input_data ImportError: No module named examples.tutorials.mnist

When I check into the directory, the file is perfectly there:

And the directory is:

enter image description here

The input_data.py is like:

The input_data.py

Kevin Ling
  • 540
  • 2
  • 7
  • 15

2 Answers2

3

Just rename your example from "tensorflow.py" to anything else and it will work. The interpreter is trying to import the necessary files from your script.

IamK
  • 2,753
  • 5
  • 30
  • 39
-3

Did you already install tensorflow? If not, follow their install instructions or simply install using pip:

pip install tensorflow

Now, make sure you are NOT currently in a folder where tensorflow is located, and try running your script.

python your_script.py
Hafager
  • 30
  • 3