我尝试从 ubuntu 软件中卸载 codeblocks。单击后,remove
它显示“无法删除 code::blocks IDE。没有要删除的软件包”
我尝试了另一种方法,在终端中运行sudo apt-get purge 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.62.0 but it is not installable
Depends: libhunspell-1.4-0 but it is not installable
Depends: libwxgtk3.0-0v5 (>= 3.0.2+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.2+dfsg) but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
如何卸载 codeblocks?
跑步后dpkg -l | grep codeblocks
iU codeblocks 20.03-3 amd64 Code::Blocks integrated development environment (IDE)
iU codeblocks-common 20.03-3 all common files for Code::Blocks IDE
iU codeblocks-contrib 20.03 amd64 contrib plugins for Code::Blocks IDE
ii codeblocks-contrib-common 20.03 all common files for the contrib plugins for Code::Blocks IDE
iU codeblocks-dev 20.03 amd64 Code::Blocks development libraries (SDK)
ii codeblocks-headers 20.03 all Code::Blocks development headers (SDK)
iU codeblocks-libwxcontrib0 20.03 amd64 Code::Blocks shared libraries for wxContribItems
iU codeblocks-libwxcontrib0-dbgsym 20.03 amd64 Debug symbols for codeblocks-libwxcontrib0
iU codeblocks-wxcontrib-dev 20.03 amd64 Code::Blocks development libraries for wxContribItems
iU codeblocks-wxcontrib-headers 20.03 all Code::Blocks development headers for wxContribItems
iU libcodeblocks0 20.03-3 amd64 Code::Blocks shared library
答案1
可供下载的软件包是 Debian 版本。由于文件冲突,这些软件包与 Ubuntu 不兼容。Codeblocks 可从 Ubuntu 上的默认 Universe 存储库(版本 20.03-3)获取。此外,Ubuntu 软件包已合并为几个软件包,因此无需下载任何额外内容。
第一的,使用以下命令卸载 debian codeblocks 包:
sudo dpkg -P $(dpkg -l | grep codeblocks | awk '{print $2}') libwxsmithlib0 libwxsmithlib0-dev wxsmith-dev wxsmith-headers
然后,运行以下命令来更新您的软件包列表并从 Ubuntu 存储库重新安装 codeblocks:
sudo add-apt-repository universe
sudo apt update
sudo apt install --reinstall $(apt-cache search codeblocks | awk '{print $1}')
为了解释所使用的命令,以下命令搜索并列出与 codeblocks 相关的包:
apt-cache search codeblocks
第一列(左侧)列出了软件包名称。因此,要仅列出软件包名称,我们可以使用awk
仅打印第一列,如下所示$1
:
apt-cache search codeblocks | awk '{print $1}'
要将该命令的输出插入到另一个命令中,我们可以使用$()
。因此,要安装上述命令列出的软件包,我们可以使用以下命令:
sudo apt install --reinstall $(apt-cache search codeblocks | awk '{print $1}')
其他帮助:
搜索可用的包,你可以apt-cache search
像这样使用:
apt-cache search codeblocks
过滤结果为了仅包含包含单词“codeblocks”的结果,我们可以使用grep
如下命令:
apt-cache search codeblocks | grep -i codeblocks
了解更多信息对于特定的包,我们可以使用apt-cache show
这样的命令:
apt-cache show codeblocks
要列出所有已安装的软件包,我们可以dpkg -l
像这样使用和过滤结果:
dpkg -l | grep codeblocks
点击此处了解有关 dpkg 状态代码的更多信息(例如,ii
,iU
等等)。基本上,ii
表示完全安装,iU
表示包未完全安装。