我无法删除软件包并显示 E:未满足的依赖关系。尝试不使用任何软件包的“apt --fix-broken install”(或指定解决方案)

我无法删除软件包并显示 E:未满足的依赖关系。尝试不使用任何软件包的“apt --fix-broken install”(或指定解决方案)

我正在尝试删除 codeblocks 包,如下所示,但它显示如下错误。我尝试了以下方法:

sudo apt-get install -f
sudo apt-get update
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get autoremove

在运行时sudo apt-get remove codeblocks,我看到以下错误:

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:
 codeblocks-contrib : Depends: libboost-system1.67.0 but it is not going to be installed
                      Depends: libwxgtk3.0-0v5 (>= 3.0.4+dfsg) but it is not installable
                      Depends: libwxsmithlib0 (= 20.03) but 20.03-3 is to be installed
                      Depends: codeblocks (= 20.03) but it is not going to be installed
                      Recommends: valgrind but it is not going to be installed
                      Recommends: cppcheck but it is not going to be installed
                      Recommends: cscope but it is not going to be installed
                      Recommends: cccc but it is not going to be installed
 codeblocks-dev : Depends: libcodeblocks0 (= 20.03) but 20.03-3 is to be installed
 codeblocks-libwxcontrib0 : Depends: libwxgtk3.0-0v5 (>= 3.0.4+dfsg) but it is not installable
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 package was automatically installed and is no longer required:
  libllvm9
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  codeblocks-contrib codeblocks-dev
Recommended packages:
  valgrind
The following packages will be REMOVED:
  codeblocks-libwxcontrib0 codeblocks-libwxcontrib0-dbgsym codeblocks-wxcontrib-dev codeblocks-wxcontrib-headers
The following packages will be upgraded:
  codeblocks-contrib codeblocks-dev
2 upgraded, 0 newly installed, 4 to remove and 33 not upgraded.
6 not fully installed or removed.
Need to get 0 B/4.969 kB of archives.
After this operation, 6.059 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 190539 files and directories currently installed.)
Preparing to unpack .../codeblocks-contrib_20.03-3_amd64.deb ...
Unpacking codeblocks-contrib (20.03-3) over (20.03) ...
dpkg: error processing archive /var/cache/apt/archives/codeblocks-contrib_20.03-3_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/codeblocks/wxContribItems/libwxchartctrl.so.0.0.1', which is also in package codeblocks-libwxcontrib0 20.03
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/codeblocks-contrib_20.03-3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

此后我无法安装任何软件包。我该如何解决这个问题?

答案1

您可以通过在终端上运行以下命令来完全删除代码块及其依赖项

sudo apt purge codeblocks
sudo apt autoremove codeblocks

相关内容