Ubuntu 中 apt fix-broken install 的问题

Ubuntu 中 apt fix-broken install 的问题

当我需要使用 apt-get 来安装一些东西时。

$sudo apt-get install autoconf automake libtool curl make g++ unzip  

Reading package lists... Done
Building dependency tree       
Reading state information... Done
make is already the newest version (4.1-9.1ubuntu1).
unzip is already the newest version (6.0-21ubuntu1).
unzip set to manually installed.
curl is already the newest version (7.58.0-2ubuntu3.8).
g++ is already the newest version (4:7.4.0-1ubuntu2.3).
g++ set to manually installed.
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 autoconf : Depends: m4 (>= 1.4.13)
 automake : Depends: autotools-dev (>= 20020320.1) but it is not going to be installed
 libtool : Depends: autotools-dev but it is not going to be installed
           Recommends: libltdl-dev but it is not going to be installed
 nvidia-cuda-toolkit : Depends: nvidia-cuda-dev (= 9.1.85-3ubuntu1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

收到此错误消息后,我尝试修复它。

但是,当我输入“sudo apt --fix-broken install”时,出现以下错误。

$sudo apt --fix-broken install                                                                                                                                      

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  nvidia-cuda-dev
Recommended packages:
  libnvcuvid1
The following NEW packages will be installed:
  nvidia-cuda-dev
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
38 not fully installed or removed.
Need to get 0 B/263 MB of archives.
After this operation, 734 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 222357 files and directories currently installed.)
Preparing to unpack .../nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb ...
Unpacking nvidia-cuda-dev (9.1.85-3ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb (--unpack):
 trying to overwrite '/usr/include/cublas.h', which is also in package libcublas-dev 10.2.2.89-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1) 

在这里,我已经多次遇到有关 nvidia-cuda-dev 的这个问题。我安装了 cuda 10.2 版本。但我不知道它为什么要使用版本 9?但我需要这个版本(10.2),我不想更改它,因为我担心我的环境会出错。

$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

该包nvidia-cuda-toolkit依赖于nvidia-cuda-dev。包含也在包中的nvidia-cuda-dev文件,因此只能同时安装这两个包中的一个,当前是。/usr/include/cublas.hlibcublas-devlibcublas-dev

因此基本上你可以选择其中一个nvidia-cuda-toolkitlibcublas-dev但不能同时选择两个。删除其中一个。

它似乎libcublas-dev是为另一个发行版或 Ubuntu 版本制作的,并且与 Ubuntu 18.04 不兼容。

相关内容