今天想重跑三个月前的一个tensorflow的代码。但是python train.py.时,突然发现很慢,于是利用nvidia-smi查看一下情况,发现GPU没有调用起来。
1.查看问题
利用下面代码查看安装
pip list
从这里可以发现tensorflow的版本为1.14 tensorflow-gpu的版本为1.12.(如果想使用GPU则tensorflow-gpu的版本一定不能比tensorflow的版本低),我也不知道自己什么时候装了tensorflow。晕。
2.解决方法
可以不要选择其他方法,就是卸载在重装,其他的方法有坑。
卸载tensorflow及tensorflow-gpu
pip uninstall tensorflow
pip uninstall tensorflow-gpu
pip uninstall protobuf
仅安装tensorflow-gpu(使用清华源),我安装tf-gpu1.12是与cuda cudnn对应的。
pip install tensorflow-gpu==1.12.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
参考链接:https://blog.csdn.net/kudou1994/article/details/86735451#commentBox