遇到问题
azheng@lishizheng:/mnt/e/shizheng_coding/fluent_python_reading_books$ sudo apt-get install vim-gnome
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
vim-gnome : Depends: vim-gui-common (= 2:7.4.052-1ubuntu3.1) but 2:8.1.2269-1ubuntu5.7 is to be installed
Depends: vim-common (= 2:7.4.052-1ubuntu3.1) but 2:8.1.2269-1ubuntu5.7 is to be installed
Depends: vim-runtime (= 2:7.4.052-1ubuntu3.1) but 2:8.1.2269-1ubuntu5.7 is to be installed
Depends: libperl5.18 (>= 5.18.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
解决方法
备份源文件
$sudo cp -i /etc/apt/sources.list /etc/apt/sources.list_backup
然后用vim打开/etc/apt/sources.list ,替换源。
vim /etc/apt/sources.list
vim的具体用法就不赘述了
替换国内的源
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
发现错误
Err:11 http://ppa.launchpad.net/pkg-vim/vim-daily/ubuntu focal Release
404 Not Found [IP: 91.189.95.85 80]
使用下面命令,删掉对应的ppa
先找到ppa所在的目录cd /etc/apt/sources.list.d/ 然后删除对应的list
azheng@lishizheng:/mnt/e/shizheng_coding/fluent_python_reading_books$ cd /etc/apt/sources.list.d/
azheng@lishizheng:/etc/apt/sources.list.d$ ls
pkg-vim-ubuntu-vim-daily-focal.list ubuntu-desktop-ubuntu-ubuntu-make-focal.list
pkg-vim-ubuntu-vim-daily-focal.list.save ubuntu-desktop-ubuntu-ubuntu-make-focal.list.save
azheng@lishizheng:/etc/apt/sources.list.d$ sudo rm pkg-vim-ubuntu-vim-daily-focal.list
azheng@lishizheng:/etc/apt/sources.list.d$ ls
pkg-vim-ubuntu-vim-daily-focal.list.save ubuntu-desktop-ubuntu-ubuntu-make-focal.list.save
ubuntu-desktop-ubuntu-ubuntu-make-focal.list
azheng@lishizheng:/etc/apt/sources.list.d$ sudo rm pkg-vim-ubuntu-vim-daily-focal.list.save
azheng@lishizheng:/etc/apt/sources.list.d$ ls
ubuntu-desktop-ubuntu-ubuntu-make-focal.list ubuntu-desktop-ubuntu-ubuntu-make-focal.list.save
然后再update就没事了
azheng@lishizheng:/etc/apt/sources.list.d$ sudo apt-get update
Hit:1 http://mirrors.aliyun.com/ubuntu bionic InRelease
Hit:2 http://mirrors.aliyun.com/ubuntu bionic-security InRelease
Hit:3 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease
Hit:4 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease
Hit:5 http://mirrors.aliyun.com/ubuntu bionic-backports InRelease
Reading package lists... Done
接下来再安装vim-gnome
azheng@lishizheng:/etc/apt/sources.list.d$ sudo apt-get install vim-gnome
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
vim-gnome
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 13.0 kB of archives.
After this operation, 171 kB of additional disk space will be used.
Get:1 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 vim-gnome all 2:8.0.1453-1ubuntu1.8 [13.0 kB]
Fetched 13.0 kB in 0s (64.3 kB/s)
Selecting previously unselected package vim-gnome.
(Reading database ... 92518 files and directories currently installed.)
Preparing to unpack .../vim-gnome_2%3a8.0.1453-1ubuntu1.8_all.deb ...
Unpacking vim-gnome (2:8.0.1453-1ubuntu1.8) ...
Setting up vim-gnome (2:8.0.1453-1ubuntu1.8) ...
参考
解决Ubuntu 安装vim 的Package vim has no installation candidate问题,100%有效 更换源 Ubuntu如何添加删除PPA
|