Ubuntu20.04卸载cuda12.0

解决方法

刚装cuda的时候没仔细看版本,默认安装了cuda12.0,然后发现pytorch并不支持12.0的版本,于是卸载重装,先贴解决办法再吐槽:解决办法是参考的Nvidia官方文档
只需要两步:

sudo apt-get --purge remove "*cuda*" "*cublas*" "*cufft*" "*cufile*" "*curand*"  "*cusolver*" "*cusparse*" "*gds-tools*" "*npp*" "*nvjpeg*" "nsight*" "*nvvm*"
sudo apt-get autoremove

官方文档中实际上是三步:

#To remove CUDA Toolkit:
sudo apt-get --purge remove "*cuda*" "*cublas*" "*cufft*" "*cufile*" "*curand*" \
 "*cusolver*" "*cusparse*" "*gds-tools*" "*npp*" "*nvjpeg*" "nsight*" "*nvvm*"
#To remove NVIDIA Drivers:
sudo apt-get --purge remove "*nvidia*" "libxnvctrl*"
#To clean up the uninstall:
sudo apt-get autoremove

其中第二步是用来卸载nvidia驱动的,但是我想保留驱动而只卸载cuda所以就跳过了。

吐槽

之所以写这个贴是因为网上提供的一些方法太旧了,基本上都是在/usr/local/cuda-xx.x/bin文件夹中直接执行卸载程序,但是cuda12.0版本似乎没有这个卸载程序,实现不了,看了诸多帖子无法实现后只好去看官方文档。

猜你喜欢

转载自blog.csdn.net/weixin_44405843/article/details/129816716