Some of the previous preparations will not be detailed here.

CUDA and cuDNN: how to install and configure. You can see a blog that  tell you how to configure pytorch.

https://blog.csdn.net/m0_72572822/article/details/129938788?spm=1001.2014.3001.5501

And then I'll talk about how to install tensorflow-gpu. Okay.

Having installed CUDA and cuDNN,use conda to create a new enviroment of python.

conda create -n tensorflow2 python=3.8
conda activate tensorflow2

Then we can use this command to speed up the download.

pip config set global.index-url https://opentuna.cn/pypi/web/simple

Here I download the method is as follows.

pip install tensorflow-gpu==2.6.0

Install tensorflow-gpu==2.6.0_tensorflow

You can see the download speed is very fast.

At the end you will find the following prompt for a successful installation.

Install tensorflow-gpu==2.6.0_CUDA_02

Input python to test.

Install tensorflow-gpu==2.6.0_tensorflow_03

import tensorflow as tf

If it shows the following error message:

Install tensorflow-gpu==2.6.0_CUDA_04

Here's my solution.

pip install protobuf==3.20.0

Install tensorflow-gpu==2.6.0_CUDA_05

Try again to test it.

Install tensorflow-gpu==2.6.0_python_06

This is already done.