安装 vim 或 vim-tiny 时未满足的依赖项

安装 vim 或 vim-tiny 时未满足的依赖项

我正在尝试安装 vi 和 vim

我最初安装了 vi,但无法安装 vim,然后我删除了 vi,现在我无法安装两者。

我查看了互联网上的所有帖子,都说你应该更新、卸载或清除,然后重新安装,但都不起作用。

以下是日志:

[root@artik ~]# apt-get install vi.tiny
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package vi.tiny
E: Couldn't find any package by glob 'vi.tiny'
E: Couldn't find any package by regex 'vi.tiny'



[root@artik ~]# apt-get install vim
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 : Depends: vim-common (= 2:8.1.0788-0york0~16.04) but 2:8.1.0837-0york0~16.04 is to be installed
       Depends: vim-runtime (= 2:8.1.0788-0york0~16.04) but 2:8.1.0837-0york0~16.04 is to be installed
E: Unable to correct problems, you have held broken packages.

现在,归档/etc/apt/sources.list

[root@artik ~]# cat /etc/apt/sources.list
deb http://ports.ubuntu.com/ubuntu-ports/ xenial main universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main universe
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main universe
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main universe
deb [arch=armhf] https://download.docker.com/linux/ubuntu xenial stable
# deb-src [arch=armhf] https://download.docker.com/linux/ubuntu xenial stable
deb http://archive.ubuntu.com/ubuntu xenial main universe
# deb-src http://archive.ubuntu.com/ubuntu xenial main universe

我在 Artik 主板上运行 ubuntu

编辑:在 /etc/apt/sources.list.d/ 里面我有:

[root@artik ~]# ls /etc/apt/sources.list.d/
artik-e2e-source.list
artik-e2e-source.list.save
artik-platform-artik533s-sources.list
artik-platform-artik533s-sources.list.save
jonathonf-ubuntu-vim-xenial.list
jonathonf-ubuntu-vim-xenial.list.save
nodesource.list
nodesource.list.save

和 apt-cache

[root@artik ~]# apt-cache policy vim vim-common
vim:
  Installed: (none)
  Candidate: 2:8.1.0788-0york0~16.04
  Version table:
     2:8.1.0788-0york0~16.04 500
        500 http://ppa.launchpad.net/jonathonf/vim/ubuntu xenial/main armhf Packages
     2:7.4.1689-3ubuntu1.2 500
        500 http://ports.ubuntu.com/ubuntu-ports xenial-security/main armhf Packages
        500 http://ports.ubuntu.com/ubuntu-ports xenial-updates/main armhf Packages
     2:7.4.1689-3ubuntu1 500
        500 http://ports.ubuntu.com/ubuntu-ports xenial/main armhf Packages
vim-common:
  Installed: (none)
  Candidate: 2:8.1.0837-0york0~16.04
  Version table:
     2:8.1.0837-0york0~16.04 500
        500 http://ppa.launchpad.net/jonathonf/vim/ubuntu xenial/main armhf Packages
        100 /var/lib/dpkg/status
     2:8.1.0788-0york0~16.04 500
        500 http://ppa.launchpad.net/jonathonf/vim/ubuntu xenial/main armhf Packages
     2:7.4.1689-3ubuntu1.2 500
        500 http://ports.ubuntu.com/ubuntu-ports xenial-security/main armhf Packages
        500 http://ports.ubuntu.com/ubuntu-ports xenial-updates/main armhf Packages
     2:7.4.1689-3ubuntu1 500
        500 http://ports.ubuntu.com/ubuntu-ports xenial/main armhf Packages

编辑2:

当我这样做时,apt-get update我收到一个错误,我不知道它是否重要:

Err:7 http://archive.ubuntu.com/ubuntu xenial/main armhf Packages
  404  Not Found [IP: 91.189.88.162 80]

答案1

看来你没跑sudo apt-get update

此外,您似乎已经安装了ppappa应该列在位于 的文件中/etc/apt/sources.list.d,而不会列在 中/etc/apt/sources.list

运行以下命令:

sudo apt-get update
sudo apt-get install --reinstall vim=2:8.1.0837-0york0~16.04

如果此方法无效,请告诉我,我们可以调查您是否仍安装了ppa。如果没有,那么您可能需要重新安装ppa。如果您不想要ppa,那么您需要清除您的apt-cache并做一些其他事情来补救,如果需要,我可以为您提供有关如何执行此操作的进一步说明。

请发布任何错误。谢谢!


首先,通过运行以下命令修复您的 sources.list 文件,因为它包含一行不应该存在的行:

sudo sed -i 's/\(deb http...archive\)/#\1/g' /etc/apt/sources.list
sudo apt-get update

如果您已删除 ppa,请运行以下命令:

sudo apt-get clean
sudo apt-get update
sudo apt-get remove vim vim-common vim-runtime
sudo apt-get install vim vim-common vim-runtime

请发布更多错误。谢谢!

答案2

解决方案如下:

sudo apt-get purge vim-common
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install vim

问题解决了。

答案3

E: Unable to locate package vi.tiny
E: Couldn't find any package by glob 'vi.tiny'
E: Couldn't find any package by regex 'vi.tiny'

只是说 ubuntu repo 中不存在包或程序 vi.tiny。您可以先尝试安装 vi 看看是否可行。

# apt-get install vi

至于 vim,听起来你有一些损坏的软件包,aptitude通常很擅长修复此类问题,所以你可以尝试

# apt-get install aptitude
...
# aptitude install vim

相关内容