在装环境的时候,cuda是较为难装得,各种版本冲突,各种版本满天飞,有时候版本冲突了,直接全部清除重新安装
<pre>$ sudo apt-get --purge remove "*cublas*" "cuda*" "nsight*"
$ sudo apt-get --purge remove "*nvidia*"
$ sudo rm -rf /usr/local/cuda*
$ sudo vim /etc/apt/sources.list
找到下面这行注释掉
#deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /
$ sudo apt-get update
现在就可以开启重新安装了
重新安装cuda最好是能够在官网上去找命令。
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-ubuntu2204-11-8-local_11.8.0-520.61.05-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2204-11-8-local_11.8.0-520.61.05-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2204-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda</pre>
还有NVIDIA驱动的卸载,可以用以下命令卸载干净
sudo apt-get --purge remove nvidia*
sudo apt autoremove
dpkg -l | grep nvidia
sudo apt-get --purge remove "*nvidia*"
dpkg -l | grep nvidia
reboot
网友评论