损坏的 perl 软件包

损坏的 perl 软件包

我正在尝试在 ubuntu 上安装 git,但是它返回

root@localhost:~# apt install git
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:
 git : Depends: perl but it is not going to be installed
       Depends: liberror-perl but it is not installable
E: Unable to correct problems, you have held broken packages.

我知道很多时候 git 是默认安装的。但这次不是。任何帮助都将不胜感激。

谢谢。

答案1

Git 默认未安装,但在您更新软件包信息后可以安装:

sudo apt update

另外,请确保您已支持 Ubuntu 版本cat /etc/lsb-release。目前支持的 Ubuntu 版本有 16.04 LTS、18.04 LTS、19.10,ESM 付费支持版本从 12.04 到 18.04。

对于 Ubuntu 19.10,你可以执行以下操作/etc/apt/sources.list

cat /etc/apt/sources.list
deb http://en.archive.ubuntu.com/ubuntu/ eoan main restricted
deb http://en.archive.ubuntu.com/ubuntu/ eoan-updates main restricted
deb http://en.archive.ubuntu.com/ubuntu/ eoan universe
deb http://en.archive.ubuntu.com/ubuntu/ eoan-updates universe
deb http://en.archive.ubuntu.com/ubuntu/ eoan multiverse
deb http://en.archive.ubuntu.com/ubuntu/ eoan-updates multiverse
#deb http://en.archive.ubuntu.com/ubuntu/ eoan-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu eoan-security main restricted
deb http://security.ubuntu.com/ubuntu eoan-security universe
deb http://security.ubuntu.com/ubuntu eoan-security multiverse

但是如果你启用了一些测试或不稳定的存储库并从中安装了一些包,它们可能会指向不存在的包。你也可以将/etc/apt/sources.list.d/*配置文件移动到其他备份文件夹。

然后,您可以尝试删除依赖包(如果存在),然后sudo apt cleansudo apt update尝试sudo apt install git一次。

sudo apt install -f当您通常使用dpkg -i <package-name>.deb命令手动安装某些软件包时,您也可以使用它来纠正问题。

相关内容