根据这个帖子https://blog.csdn.net/bragen/article/details/129131278
TensorFlow2.10以后的版本都不支持windows原生的GPU支持了,太坑了
因此要安装旧版的TensorFlow2.10,根据官方文档,先下载安装它要求版本的cuda和cuDNN
然后根据官方另外一个英文文档来
先用conda创建一个虚拟环境,注意python版本要在Python 3.7–3.10,否则不支持
conda create -n tf2 python=3.10
然后按照上图的教程来,如果你已经下载和安装了cuda和cuDNN,那就不用再用conda安装一次了
conda activate tf2
pip install "tensorflow<2.11"
完了验证一下
>python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
搞了一天,终于成功了