tensorflow gpu environment installation

Check the highest cuda version supported by this computer: nvidia-smi

Modify the conda source in ~/.condarc:

show_channel_urls: true
ssl_verify: false
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
  - defaults

#The following command can view the relationship between each sub-version of cudnn8 and the cuda version: conda search cudnn=8 --info

conda create -n tensorflow_gpu3 python=3.7 cudnn=7.6.5.32 cudatoolkit=10.2.89

conda activate tensorflow_gpu3

pip install tensorflow-gpu==2.11.0

Verify that the installation was successful

Enter the python environment:

import tensorflow as tf

tf.config.list_physical_devices('GPU')

Guess you like

Origin blog.csdn.net/sslfk/article/details/129045085