我最近尝试使用 64 位二进制文件安装 code:blocks这链接,这显然是我对我的机器做的最糟糕的事情。我最终无法使用该包安装程序,最终无法安装 tar 文件中的任何 deb 包,因为依赖关系未得到满足。现在我的系统无法使用 apt-get 命令安装软件,因为它会因 codeblocks 依赖关系错误而发送此错误。
The following packages have unmet dependencies:
codeblocks-contrib : Depends: libwxsmithlib0 (= 13.12-1) but 13.12-3 is installed
Depends: codeblocks (= 13.12-1) but 13.12-3 is installed
Recommends: valgrind but it is not installed
Recommends: cppcheck but it is not installed
Recommends: cscope but it is not installed
Recommends: cccc but it is not installed
codeblocks-dbg : Depends: codeblocks-contrib (= 13.12-3) but 13.12-1 is installed
codeblocks-dev : Depends: libcodeblocks0 (= 13.12-1) but 13.12-3 is installed
Depends: codeblocks-headers (= 13.12-1) but it is not installable
E: Unmet dependencies. Try using -f.
当我尝试使用时,sudo apt-get install -f
我得到以下输出
$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
codeblocks-contrib codeblocks-dev
Recommended packages:
valgrind
The following packages will be upgraded:
codeblocks-contrib codeblocks-dev
2 upgraded, 0 newly installed, 0 to remove and 43 not upgraded.
4 not fully installed or removed.
Need to get 0 B/3,369 kB of archives.
After this operation, 2,954 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 244536 files and directories currently installed.)
Preparing to unpack .../codeblocks-contrib_13.12-3_amd64.deb ...
Unpacking codeblocks-contrib (13.12-3) over (13.12-1) ...
dpkg: error processing archive /var/cache/apt/archives/codeblocks-contrib_13.12-3_amd64.deb (--unpack):
trying to overwrite '/usr/lib/pkgconfig/cb_wximagepanel.pc', which is also in package codeblocks-wxcontrib-dev 13.12-1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Preparing to unpack .../codeblocks-dev_13.12-3_amd64.deb ...
Unpacking codeblocks-dev (13.12-3) over (13.12-1) ...
dpkg: error processing archive /var/cache/apt/archives/codeblocks-dev_13.12-3_amd64.deb (--unpack):
trying to overwrite '/usr/include/codeblocks/wxContribItems/wxImagePanel/include/wx/wxImagePanel.h', which is also in package codeblocks-wxcontrib-headers 13.12-1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/codeblocks-contrib_13.12-3_amd64.deb
/var/cache/apt/archives/codeblocks-dev_13.12-3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
从错误来看,我认为问题在于apt-get install -f
尝试使用与 deb 文件安装的版本不同的版本,因此无法解决依赖性问题或类似问题。这似乎是导致我使用 apt-get 命令时出现问题的根源吗?如果不是,那么问题可能出在哪里?我尝试使用 apt-get clean 和 autoclean 以及其他工具。
答案1
我刚刚想出了如何解决我的情况。我不知道这是否是最佳实践,但我基本上一直在尝试运行sudo apt-get remove codeblocks
以获取错误代码,并查看安装了哪些 codeblocks 组件并存在依赖性错误。然后我用sudo dpkg -r --force-depends <package name>
似乎导致问题的任何包替换了其中的内容。我最终不得不对 codeblocks-dev、codeblocks-contrib 和 codeblocks-dbg 执行此操作,这是我拥有的第一组错误代码。
再次,我不确定这是否是恰当的方法来做到这一点,但这样做之后,我就可以再次安装非代码块包,这对我来说很有用。