'ImportError: No module named tensorflow - Can't install Tensorflow

I am trying to install tensorflow on mac and it's giving me this error.

ImportError: No module named tensorflow

Here is what I have done in the terminal

sudo easy_install pip
sudo easy_install --upgrade six
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0-py3-none-any.whl
sudo -H pip3 install --upgrade $TF_BINARY_URL

After that I try to run python and tensorflow to check my installation. It doesn't work. I have spent 3 hours on the problem.



Solution 1:[1]

Try installing through Anaconda...

Enter this in the Terminal

export PATH=~/anaconda2/bin:$PATH  OR  export PATH=~/anaconda3/bin:$PATH

And then

conda install -c https://conda.anaconda.org/jjhelmus tensorflow

This worked for me, after trying several other approaches.

Solution 2:[2]

I use Anaconda Navigator which includes Tensorflow. I use Spyder, it's a IDE of Anaconda Navigator similar to Matlab with variable explorer, very useful.

You have to go to the page https://www.anaconda.com/download/#macos

and download and install it. It's open source. Then open Spyder and call tensorflow lib. It's the easiest mode to run tensorflow and virtualenvs.

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 eyllanesc
Solution 2 pfRodenas