1 nvidia驱动
官网链接:https://www.nvidia.cn/Download/index.aspx?lang=cn
2 CUDA下载链接
官方CUDA:https://developer.nvidia.com/cuda-toolkit-archive CUDA10.2传送门 推荐run安装
3 可直接命令行安装
3.1 run安装
wget https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33
.01_linux.run
3.2 deb安装:
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
4 配置
打开文件
sudo gedit ~/.bashrc
在文件中加入
export PATH="/usr/local/cuda/bin/:$PATH"
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda
刷新环境
source ~/.bashrc
5 ubuntu删除旧版本的CUDA
sudo apt-get --purge remove cuda-*
reboot
6 error code(1)
cd /var/lib/dpkg
sudo mv info info.baksudo
mkdir info
|