Linux软件未完全安装带来的问题及解决方案--E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

最近使用Debian搭建CS服务器,安装各种命令包遇见一些问题,一般是依赖错误、安装目录已存在其他文件(可能是同类的命令包存放相同位置导致的)

我的环境:Debian9

我遇到的问题是为python3环境安装pip3产生的报错,当时我想了一个暴力的解决方法,直接下载pip安装包本地解压安装,当时解决了这个问题 ,但是我再装别的命令包就会有以下报错:

The following packages have unmet dependencies:
bsdmainutils : Depends: bsdextrautils (>= 2.35.2-7) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

dpkg: error processing archive /var/cache/apt/archives/bsdextrautils_2.36-3+b1_amd64.deb (--unpack):
 trying to overwrite '/usr/share/bash-completion/completions/hexdump', which is also in package bash-completion 1:2.1-4.3

  结合这篇文章大体明白了自己的问题可能就是之前装bsdmainutils命令包没装完,存在目录上的一些问题:然后使用文章中的方法步骤,找到出错的命令包位置,使用以下指令:

root@fish2:~# dpkg -i --force-overwrite  /var/cache/apt/archives/bsdextrautils_2.36-3+b1_amd64.deb
(Reading database ... 117779 files and directories currently installed.)
Preparing to unpack .../bsdextrautils_2.36-3+b1_amd64.deb ...
Unpacking bsdextrautils (2.36-3+b1) ...
dpkg: warning: overriding problem because --force enabled:    //警告无报错
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/hexdump', which is also in package bash-completion 1:2.1-4.3
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/bash-completion/completions/look', which is also in package bash-completion 1:2.1-4.3
Setting up bsdextrautils (2.36-3+b1) ...
update-alternatives: warning: alternative /usr/bin/bsd-write (part of link group write) doesn't exist; removing from list of alternatives
update-alternatives: warning: /etc/alternatives/write is dangling; it will be updated with best choice
update-alternatives: using /usr/bin/write.ul to provide /usr/bin/write (write) in auto mode

接着这样:

root@fish2:~# apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libisl22 libllvm3.9 libpciaccess0 libruby2.3
  libtxc-dxtn-s2tc libzstd1 ruby-did-you-mean ruby2.3
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 588 not upgraded.
8 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct!
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "zh_CN.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Processing triggers for cracklib-runtime (2.9.2-5) ...
Setting up libmpfr6:amd64 (4.1.0-3) ...
Setting up libzstd1:amd64 (1.4.5+dfsg-4) ...
Setting up ncal (12.1.7) ...
Setting up libbsd0:amd64 (0.10.0-1) ...
Setting up calendar (12.1.7) ...
Processing triggers for libc-bin (2.31-3) ...
Setting up libmpc3:amd64 (1.2.0-1) ...
Setting up libisl22:amd64 (0.22.1-1) ...
Setting up bsdmainutils (12.1.7) ...
Processing triggers for man-db (2.7.6.1-2) ...
Processing triggers for libc-bin (2.31-3) ...

 然后再用apt-get install  python-pip    命令包    就可以了

 

原文地址:https://www.cnblogs.com/Qiuzhiyu/p/13729466.html