'No module named tensorflow.python.platform

I am running tensorflow/g3doc/tutorials/mnist/fully_connected_feed.py. I get:

hiro106@hiro106-virtual-machine:~$ python tensorflow/tensorflow/g3doc/tutorials/mnist/fully_connected_feed.py
Traceback (most recent call last):
File "tensorflow/tensorflow/g3doc/tutorials/mnist/fully_connected_feed.py", line 33, in 
import tensorflow.python.platform
ImportError: No module named tensorflow.python.platform


Solution 1:[1]

Try this, it worked for me:

sudo pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl

Solution 2:[2]

Does import tensorflow work in a Python shell?

If not, try reinstalling with pip install --upgrade --force-reinstall <package>.

For example, for TensorFlow version 1.12 with GPU support: pip install --upgrade --force-reinstall tensorflow-gpu==1.12.0

Solution 3:[3]

This helped me.

PYTHONPATH="${PYTHONPATH}:/usr/local/lib/python2.7/dist-packages/"
export PYTHONPATH

Make sure to check your path with this: echo $PYTHONPATH

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 FelixSFD
Solution 2 AI Mechanic
Solution 3 Ranjeet R Patil