![安装 CUDA 10.2 后未满足的依赖关系](https://linux22.com/image/1169655/%E5%AE%89%E8%A3%85%20CUDA%2010.2%20%E5%90%8E%E6%9C%AA%E6%BB%A1%E8%B6%B3%E7%9A%84%E4%BE%9D%E8%B5%96%E5%85%B3%E7%B3%BB.png)
我尝试使用 apt 安装 cuda 10.2。安装到一半时出现错误。我能够直接从 Nvidea 网站运行 .run 文件进行安装。但是现在执行以下操作时:
$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies.
cuda-libraries-dev-10-2 : Depends: libcublas-dev (>= 10.2.2.89) but it is not installed
cuda-samples-10-2 : Depends: libcublas-dev (>= 10.2.2.89) but it is not installed
cuda-visual-tools-10-2 : Depends: libcublas-dev (>= 10.2.2.89) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
然后做的时候:
$ sudo apt --fix-broken install
我得到:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libllvm7 libllvm7:i386 libnvidia-common-390 libwayland-client0:i386
libwayland-server0:i386
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libcublas-dev
The following NEW packages will be installed
libcublas-dev
0 to upgrade, 1 to newly install, 0 to remove and 33 not to upgrade.
62 not fully installed or removed.
Need to get 0 B/42.3 MB of archives.
After this operation, 114 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 file:/var/cuda-repo-10-2-local-10.2.89-440.33.01 libcublas-dev 10.2.2.89-1 [42.3 MB]
(Reading database ... 473743 files and directories currently installed.)
Preparing to unpack .../libcublas-dev_10.2.2.89-1_amd64.deb ...
Unpacking libcublas-dev (10.2.2.89-1) ...
dpkg: error processing archive /var/cuda-repo-10-2-local-10.2.89-440.33.01/./libcublas-dev_10.2.2.89-1_amd64.deb (--unpack):
trying to overwrite '/usr/include/nvblas.h', which is also in package nvidia-cuda-dev 9.1.85-3ubuntu1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cuda-repo-10-2-local-10.2.89-440.33.01/./libcublas-dev_10.2.2.89-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
执行时:
$nvcc --version
我得到:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
关于如何修复破损的包裹您有什么想法吗?
答案1
好的,我在网上找到了解决办法:
1) 我将主要配置文件切换到英特尔。2) 将 cuda.list 文件移动到其他地方(我安装的 10.2 版本)3) 在 .bashrc 中注释指向 cuda 10.2 路径的行(不确定是否有必要)4) 重新启动 5) $ sudo apt --fix-broken install
(这次成功了!)
6) 将 prime 配置文件切换回 nvidia 7) 取消 .bashrc 中的注释行(反向步骤 3) 8) $ source .bashrc
并且成功了。我现在已经安装了 cuda 10.2,apt 不再有损坏的依赖关系。:-)