Ubuntu類似下面的安裝包依賴問題: libc6-dev : 依賴: libc6 (= 2.23-0ubuntu11) 但是 2.27-3ubuntu1 正要被安裝 build-essential: 依賴: g++ (>= 4:4.3.1) 但是它將不會被安裝 …… 我原來用的清華源,在安裝一些包的時候會碰到類似上面的問題,嘗試安裝aptitude,但是aptitude安裝的時候會強制你卸載apt,然後用aptitude安裝這些包時,又出現了"無法找到獲取軟件包的渠道 /usr/lib/apt/methods/https 所需的驅動程序"這樣的問題,結果apt,aptitude都用不了。 於是嘗試在官網上下載apt包,用dpkg安裝apt,又失敗了,最後只好刪了虛擬機,重新裝了個Ubuntu。 在新裝的Ubuntu上,我嘗試把源更換成了阿裏源,結果在安裝包時再也沒出現過安裝包依賴的問題了。 NB,阿裏源!
下面是換源方法:
1.將原來的源文件備份cd /etc/apt
sudo mv sources.list sources.list.back
2.更換為阿裏源sudo vim sources.list
將下面的阿裏源複制粘貼進去
阿裏源:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
3.更新軟件sudo apt-get update
sudo apt-get upgrade