TensorFlow无法捕获GPU [英] GPU not captured by TensorFlow
本文介绍了TensorFlow无法捕获GPU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Windows的Anaconda虚拟环境中使用 pip install tensorflow
安装了 tensorflow
.
I installed tensorflow
using pip install tensorflow
within Anaconda virtual environment on Windows.
我试图测试是否启用了GPU,然后键入
I tried to test whether GPU is enabled, and type
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
得到了
Num GPUs Available: 0
我的系统确实启用了CUDA和CUDNN,因为安装PyTorch GPU版本没有问题.如何为TensorFlow启用GPU?
My system does have CUDA and CUDNN enabled, as I do not have a problem installing PyTorch GPU version. How do I enable GPU for TensorFlow?
推荐答案
首先,使用
pip uninstall tensorflow
安装 tensorflow-gpu
版本
pip install tensorflow-gpu==2.2.0
如果无法使用pip,则可以尝试使用 conda install命令.
If using pip did't work you can try with conda install command.
conda install -c anaconda tensorflow-gpu
这将自动安装 CUDA&cuDNN.
希望这能解决您的问题.
This will automatically install CUDA & cuDNN.
Hope this will solve your issue.
这篇关于TensorFlow无法捕获GPU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文