1. Download and install Anaconda
https://anaconda.org/
2. Check the version
https://tensorflow.google.cn/install/source_windows
3. Create a new environment
3.1 Open Anaconda Prompt
3.2 Create a new environment:conda create --name myenv python=3.7
(myenv is the name you gave this environment, python=3.7 is your python version, both of the above can be modified)
3.3 Enter the new environment:conda activate myenv
(Myenv is the same as above and replaced with the environment name you chose)
4. Download CUDA and cuDNN
4.1 Select the corresponding version of CUDA to download:
https://developer.nvidia.com/cuda-toolkit-archive
- If you want to download in the myenv environment created before, enter after step 3.3
conda install cudatoolkit=10.1
4.2 Select the corresponding version cuDNN to download:
After decompressing https://developer.nvidia.com/rdp/cudnn-archive
, copy the three folders bin include lib to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1 (bin under the CUDA installation path) include lib in these three folders)
- If you want to download in the myenv environment created before, enter after step 3.3
conda install cudnn=7.6
4.3 Environment variables
In the system variables, find path and add the following installation path (if it already exists, there is no need to add it again):
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp
5. Download TensorFlow-GPU:
5.1 Open Anaconda Prompt
5.2 Enter the environment created previously:conda activate myenv
5.3 Download the corresponding version:pip install tensorflow-gpu==2.3
6. Check whether it is installed properly:
After entering the created environment, enter
python
import tensorflow as tf
tf.__version__
tf.test.is_gpu_available()
If it returns True, it means it is installed.