问题描述
mac@10-SYS-7048GR-TR:~$ sudo apt-get -y install cuda
Reading package lists... Done
Building dependency tree
Reading state information... Done
cuda is already the newest version (12.0.0-1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:cuda-cudart-12-0 : Depends: cuda-toolkit-config-common but it is not going to be installedcuda-opencl-12-0 : Depends: cuda-toolkit-config-common but it is not going to be installedlibcublas-12-0 : Depends: cuda-toolkit-config-common but it is not going to be installedlibcufft-12-0 : Depends: cuda-toolkit-config-common but it is not going to be installedlibcufile-12-0 : Depends: cuda-toolkit-config-common but it is not going to be installedlibcurand-12-0 : Depends: cuda-toolkit-config-common but it is not going to be installedlibcusolver-12-0 : Depends: cuda-toolkit-config-common but it is not going to be installedlibcusparse-12-0 : Depends: cuda-toolkit-config-common but it is not going to be installedlibnpp-12-0 : Depends: cuda-toolkit-config-common but it is not going to be installedlibnvjitlink-12-0 : Depends: cuda-toolkit-config-common but it is not going to be installedlibnvjpeg-12-0 : Depends: cuda-toolkit-config-common but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
Unpacking cuda-toolkit-config-common (12.0.107-1) ...
dpkg: error processing archive /var/cuda-repo-ubuntu2004-12-0-local/./cuda-toolkit-config-common_12.0.107-1_all.deb (--unpack):trying to overwrite '/etc/ld.so.conf.d/000_cuda.conf', which is also in package cuda-cudart-11-2 11.2.152-1
Errors were encountered while processing:/var/cuda-repo-ubuntu2004-12-0-local/./cuda-toolkit-config-common_12.0.107-1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
解决方案:
不论提示你“Errors were encountered while processing:
xxx”,就把这个文件强制overwrite即可。
sudo dpkg -i --force-overwrite /var/cuda-repo-ubuntu2004-12-0-local/./cuda-toolkit-config-common_12.0.107-1_all.deb
然后再执行你之前的命令即可。