The reason I’m writing this blog is because I’ve been trying to install TensorFlow for over two hours and it’s not working. I’ve been looking at all the data and typing in all the code. Finally, at about two in the morning, it occurred to me that maybe my Python3.9 version is too high. The next day I decided to uninstall my Python and replace it with version 3.6, which is more stable.

Here are the most common errors:

The installation of Python3.6

Choose a 64 – bit version 3.6 on this website to download (to install TensorFlow must install 64 – bit Python, TensorFlow does not support 32-bit) www.python.org/downloads/r…

Then run the application

Install as shown in figure

Then click install to install, the installation is successful, you can check whether the installation is successful in the CMD

The installation of pycharm

Go to the website to download, and then press operated as shown in the figure below www.jetbrains.com/pycharm/dow…

Then set the interface when you first open it

The installation of TensorFlow1.6

Download Anaconda3 version 5.2 at the following url and run the installation

Repo.anaconda.com/archive/Ana…

Check these two boxes and wait for the installation to succeed

Then test environment variables. First, open CMD to check whether the Anaconda environment is installed successfully: conda –version

Install a built-in Python version of the parser in Anaconda: conda create –name TensorFlow Python =3.6

Type y to activate the environment when the load is complete: activate TensorFlow (circled indicates success)

To exit the TensorFlow environment, enter: deactivate

The last and most important step is to type the following command to install it (I tried a lot of other commands with various errors, but this one is the best, it doesn’t require you to download things locally, just type the command) :

pip install --ignore-installed -- upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.6.0-cp36-cp36m-win_amd64.whl

Finally, we embed the Tensorflow environment into the editor, here we use PyCharm, create a new project and use python3.6 in the Anaconda directory as the interface

Then test it with the following code:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
sess = tf.Session()
a = tf.constant(10)
b= tf.constant(12)
print(sess.run(a+b))
Copy the code

Successful output indicates a successful installation