1. 版本选择
tensorflow官网各gpu版本与对应cuda、cudnn版本

可以看到tf2.6推荐cuda11.2版本
2.cuda安装
CUDA Toolkit Archive | NVIDIA Developer

3. cudnn安装
下载对应版本的cudnn
NVIDIA cuDNN | NVIDIA Developer


解压缩,将所有文件复制到cuda的安装路径中,通常为C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.5
4.tf 2.6-gpu安装
pip install tensorflow-gpu==2.6.05.环境配置
tensorflow官网给出的建议如下:

6.tf-gpu测试
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))得到以下结果,则配置成功
Num GPUs Available: 17.pytorch-gpu安装
由于安装了cuda11.2,受版本限制只能安装cuda10.2对应的pytorch gpu版本

conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch版权声明:本文为kwvinst原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。