Use update-alternatives in Ubuntu to realize multi-version CUDA switching, uninstall cuda and cudnn

usage

update-alternatives: --install 需要 <链接> <名称> <路径> <优先级>
sudo update-alternatives --install /usr/local/cuda cuda /usr/local/cuda-12.2/ 122

vim ~/.bashrc enters the configuration file;

Add the following two lines:

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

Configure: sudo update-alternatives --config cuda

insert image description here

nvcc --version

insert image description here

cuda uninstall

bin directory.

sudo ./cuda-uninstaller

uninstall cudnn

Inquire:

sudo dpkg -l | grep cudnn

Uninstall it all: example

sudo dpkg -r libcudnn8-samples
sudo dpkg -r libcudnn8-dev
sudo dpkg -r libcudnn8

Check:
After entering the following command, if there is no output, the uninstallation is successful.

sudo dpkg -l | grep cudnn

Guess you like

Origin blog.csdn.net/philosophyatmath/article/details/131833279