安装tensorflow-gpu的保姆级教程

1. 查看电脑的CUDA版本

在命令窗口(cmd)中输出

nvidia-smi

在这里插入图片描述

2. 查找对应的tensorflow-gpu版本

https://tensorflow.google.cn/install/source_windows?hl=en

在这里插入图片描述

3. 发现目前最大的CUDA是11.2 ,我们是12.6,因此可以安装tensorflow_gpu-2.10.0

4.先创建一个虚拟环境,要求python版本是 3.7-3.10

conda create -n tensor-gpu210 python==3.9

在这里插入图片描述

5. 激活虚拟环境,开始安装tensorflow_gpu-2.10.0

在这里插入图片描述
在这里插入图片描述

6. 安装完成,测试一下

import tensorflow as tf
tf.__version__
import tensorflow as tf
 
print(tf.__version__)
print(tf.test.gpu_device_name())
print(tf.config.experimental.set_visible_devices)
print('GPU:', tf.config.list_physical_devices('GPU'))
print('CPU:', tf.config.list_physical_devices(device_type='CPU'))
print(tf.config.list_physical_devices('GPU'))
print(tf.test.is_gpu_available())
# 输出可用的GPU数量
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值