Error in importing tensorflow in Jupiter Notebook: no module named tensorflow solution

1. Background

First of all, my environment:

os : windows10

The official website provides two ways to install TensorFlow: PIP and anaconda. I use the anaconda method. After the installation is completed, you can import TensorFlow or run the program on the command line. Then I use the command Jupiter notebook to start Jupiter notebook in the created environment named TensorFlow. However, there is only python2 in the options of Jupiter notebook, and there is no newly installed environment, As shown in the following figure:

and when Import tensorflow as TF is executed, an error will occur: no module named TensorFlow

2. Solutions

Enter the anaconda command line, and then select TensorFlow environment:

> activate tensorflow

Execute the following command:

> conda install nb_conda

After the installation, start jupyter Notebook:

> jupyter notebook

At this time, you can see that the options for creating a file include our established environment TensorFlow


If you select TensorFlow environment and then Import tensorflow as TF , no error will occur


Similar Posts: