Windows 11环境下RTX 5060 Ti无法被TensorFlow 2.15.0识别,GPU加速训练失效求助
Windows 11环境下RTX 5060 Ti无法被TensorFlow 2.15.0识别,GPU加速训练失效求助
各位大佬好,我之前因为用的是AMD显卡,一直只能靠CPU跑TensorFlow训练模型,最近刚入了RTX 5060 Ti 16GB,结果折腾了好几天都没法让TF用上GPU,实在没辙了来求助!
我的硬件和系统配置:
- CPU: Ryzen 7 5700x
- 内存: 32GB DDR4 3200
- 显卡: RTX 5060 Ti 16GB
- 存储: NVME Gen3 1TB
- 系统: Windows 11 23H2
- Python版本: 3.10
我已经尝试过的操作:
- Windows原生Anaconda环境配置:
新建了Python3.10的conda环境,装了tensorflow、matplotlib、opencv这些常用库,还按照指引装了cudatoolkit=12.3和cudnn=8.9,但启动训练后还是用CPU,任务管理器里GPU占用几乎为0。 - 尝试匹配TF版本:
网上说最新TF在Windows上可能有兼容问题,我就试了装2.15.0版本,但TF输出显示根本没带CUDA编译,识别不到GPU。 - 切换WSL Ubuntu环境:
跟着教程开了WSL用Ubuntu控制台配置,结果还是一样,TF依旧识别不到GPU。 - 错误的安装尝试:
之前听AI说要装tensorflow-cuda2.15.0,执行命令后直接报错找不到包。
遇到的具体错误信息:
- pip安装错误:
python -m pip install --no-cache-dir tensorflow-cuda2.15.0 ERROR: Could not find a version that satisfies the requirement tensorflow-cuda2.15.0 (from versions: none) ERROR: No matching distribution found for tensorflow-cuda==2.15. - TensorFlow运行时输出(Windows和WSL环境下结果一致):
更详细的构建信息:TF 2.15.0 Built with CUDA: False GPUs: []TF: 2.15.0 Built with CUDA: False Physical GPUs: [] TF build info: { "is_cuda_build": false, "is_rocm_build": false, "is_tensorrt_build": false, "msvcp_dll_names": "msvcp140.dll,msvcp140_1.dll" }
我用的环境配置命令(Windows原生):
conda create -n tf_gpu_py310 python=3.10 -y conda activate tf_gpu_py310 conda install -c conda-forge cudatoolkit=12.3 cudnn=8.9 -y python -m pip install --upgrade pip setuptools wheel python -m pip install --no-cache-dir tensorflow==2.15.0 python -c "import tensorflow as tf; print('TF',tf.__version__); print('Built with CUDA:', tf.test.is_built_with_cuda()); print('GPUs:', tf.config.list_physical_devices('GPU'))"
现在的核心问题就是:不管怎么配,TensorFlow都显示没带CUDA编译,识别不到我的RTX 5060 Ti,一直用CPU跑。试过AI推荐的方法、看了好几个YouTube教程都没用,有没有大佬能帮我排查下问题出在哪?感激不尽!




