ImportError: "No module named tensorflow" (Keras in Anaconda environment)

10,633

Check your python version and installation command. ($ conda create -n tensorflow python=<version>)

If you install tensorflow via conda-forge use:

# Linux/Mac OS X, Python 2.7/3.4/3.5, CPU only:
(tensorflow)$ conda install -c conda-forge tensorflow

Otherwise, switch the pip command according to the python version like:

# Python 2
(tensorflow)$ pip install --ignore-installed --upgrade $TF_BINARY_URL

# Python 3
(tensorflow)$ pip3 install --ignore-installed --upgrade $TF_BINARY_URL

If this doesn't solve your problem, please provide more detailed command lines to reproduce the problem.

Share:
10,633
Abhishek
Author by

Abhishek

Updated on June 28, 2022

Comments

  • Abhishek
    Abhishek almost 2 years

    I have installed Keras and tensorflow using pip in Anaconda environment, but when I run Keras program in tensorflow background it gives error No module named tensorflow. Can you please help?

  • Abhishek
    Abhishek almost 7 years
    thanks for the help...actually I reinstalled it by running anaconda as administrator then it started working fine.