1.先装驱动,以为安装CUDA时安装最新驱动导致CUDA用不了
sudo apt-get install nvidia-396
2.参考这,安装好CUDA 9.2
https://developer.nvidia.com/cuda-92-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=deblocal
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#runfile-advanced
sudo apt-get install cuda-toolkit-9-2
sudo apt-get install cuda-libraries-9-2
然后测试cuda是否安装成功
https://docs.nvidia.com/cuda/archive/9.2/cuda-quick-start-guide/index.html#ubuntu-x86_64
或者直接下载https://developer.nvidia.com/cuda-92-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=runfilelocal
这个文件用sh安装,继续选别更新驱动
3.参考这安装好cudnn
https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#installlinux-deb