我嘗試從 ubuntu 軟體中卸載程式碼區塊。點擊後remove
顯示“無法刪除程式碼::阻止 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).
如何卸載程式碼區塊?
跑步後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(版本 20.03-3)上的預設 Universe 儲存庫取得。此外,Ubuntu 軟體包合併為幾個軟體包,因此無需下載任何額外的東西。
第一的,使用以下命令卸載 debian codeblocks 軟體包:
sudo dpkg -P $(dpkg -l | grep codeblocks | awk '{print $2}') libwxsmithlib0 libwxsmithlib0-dev wxsmith-dev wxsmith-headers
然後,執行以下命令來更新軟體包清單並從 Ubuntu 儲存庫重新安裝程式碼區塊:
sudo add-apt-repository universe
sudo apt update
sudo apt install --reinstall $(apt-cache search codeblocks | awk '{print $1}')
為了解釋所使用的命令,以下命令會搜尋並列出與程式碼區塊相關的套件:
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
表示軟體包未完全安裝。