在安装从官方网站下载的最新版本的 Code Blocks 后发生了这种情况,我无法运行它,因此我尝试删除它(sudo apt-get remove
),然后发生了这种情况。
然后我尝试:
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get -f 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:
geany-common lib32gcc1 lib32stdc++6 libatk-adaptor libgail-common
liblouis-data liblouis2 python3-brlapi python3-louis python3-pyatspi
python3-speechd
Use 'apt-get autoremove' to remove them.
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 8 not upgraded.
4 not fully installed or removed.
Need to get 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
Get:1 http://ru.archive.ubuntu.com/ubuntu/ trusty/universe codeblocks-contrib amd64 13.12-3 [3 018 kB]
Get:2 http://ru.archive.ubuntu.com/ubuntu/ trusty/universe codeblocks-dev amd64 13.12-3 [350 kB]
Fetched 3 369 kB in 0s (5 731 kB/s)
(Reading database ... 337359 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-cache policy libwxsmithlib0
libwxsmithlib0:
Installed: 13.12-3
Candidate: 13.12-3
Version table:
*** 13.12-3 0
500 http://ru.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
100 /var/lib/dpkg/status
$ apt-cache policy codeblocks
codeblocks:
Installed: 13.12-3
Candidate: 13.12-3
Version table:
*** 13.12-3 0
500 http://ru.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
100 /var/lib/dpkg/status
$ apt-cache policy codeblocks-contrib
codeblocks-contrib:
Installed: 13.12-1
Candidate: 13.12-3
Version table:
13.12-3 0
500 http://ru.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
*** 13.12-1 0
100 /var/lib/dpkg/status
$ sudo apt-get install codeblocks-contrib=13.12-3
[sudo] password for user:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
codeblocks-dev : Depends: libcodeblocks0 (= 13.12-1) but 13.12-3 is to be installed
Depends: codeblocks-headers (= 13.12-1) but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
$ apt-cache policy codeblocks-dev
codeblocks-dev:
Installed: 13.12-1
Candidate: 13.12-3
Version table:
13.12-3 0
500 http://ru.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
*** 13.12-1 0
100 /var/lib/dpkg/status
$ sudo apt-get install codeblocks-dev=13.12-3
[sudo] password for user:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
codeblocks-contrib : Depends: libwxsmithlib0 (= 13.12-1) but 13.12-3 is to be installed
Depends: codeblocks (= 13.12-1) but 13.12-3 is 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-dbg : Depends: codeblocks-contrib (= 13.12-3) but 13.12-1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
答案1
答案就在您的错误消息中。软件包codeblocks-headers
和codeblocks-dev
会尝试覆盖软件包codeblocks-wxcontrib-headers
和中的文件codeblocks-wxcontrib-dev
。
但在做出一些澄清之后聊天
dpkg -l | awk '/ codeblocks-/ {system("sudo dpkg -r --force-all " $2)}'
sudo dpkg -r --force-all libcodeblocks0
正如你在评论中所说
我通过“rm -rf”删除了这些包,但没有帮助:/usr/bin/codeblocks /usr/lib/codeblocks /usr/bin/X11/codeblocks /usr/include/codeblocks /usr/share/codeblocks /usr/share/man/man1/codeblocks.1.gz
这毫无意义。您已删除一些文件但没有包。
现在,如果你再次需要代码块,请通过以下方式重新安装
sudo apt-get install codeblocks