tensorflow版本与cuda和cudnn的对应关系:
https://tensorflow.google.cn/install/source
安装一定要查看CUDA要求的linux下的Driver Version,链接网址如下:
https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
在附加驱动中有本机所用的显卡驱动。
1. 先卸载nvidia显卡驱动并更新最新版本
nvidia的最新驱动是支持之前的老款显卡
查看原先版本号:nvidia-smi
卸载:sudo apt-get --purge remove nvidia-384 # Ubuntu
(如果卸载不了,可以直接安装会覆盖,但没有验证原驱动文件是否留着硬盘中)
官网下载:https://www.geforce.cn/drivers (最好是run版本)
安装:CTRL+ATL+F1进入终端1(输入用户名和密码后和终端很相似,可以大胆进去)
sudo service lightdm stop(关闭图形界面)
sudo ./NVIDIA-Linux-x86_64-430.34.run --no-opengl-files
测试有没OK:nvidia-smi
2.卸载cuda并更新到10.1版本
查看原版本:nvcc --version
卸载sudo /usr/local/cuda-9.0/bin/uninstall_cuda_9.0.pl
sudo rm -rf /usr/local/cuda-9.0
安装:官网下载run版本(最好使用run版本,不要deb版本,不知道装到那里去)
sudo sh cuda_10.1.168_418.67_linux.run
环境变量配置详见我之前的博客
测试有没OK:nvcc --version
3.卸载cudnn更新最新版本
卸载不需要操作,因为需要cuda这步已经完成
安装详见我之前的博客
4.升级后发现cuda是10.1,其实tensorflow只支持10
卸载cuda10.1:
sudo apt uninstall cuda
sudo autoremove
或者:
sudo apt-get --purge remove "*cublas*" "cuda"
如果要卸载驱动(不需要)
sudo apt-get --pruge remove "nvidia"
或者 apt-get remove --purge nvidia-410 nvidia-modprobe nvidia-settings
**根路径下空间不够怎么操作?
删除回收站$ sudo rm -rf ~/.local/share/Trash/*
删除cuda路径下的sample和doc文件夹
在home路径下,Ctrl+H显示隐藏的文件夹,找找看那些是没用的
5.tensorflow升级:
先卸载:pip uninstall tensorflow
再安装: pip install tensorflow-gpu==1.14
最后测试:import tensorflow as tf
print(tf.__version__)