我在安装 zlib1g-dev 时遇到了问题(我需要它才能使 rbenv 正常工作)。Apt 不会安装它,说我没有所需的依赖项(它没有确切说明我需要哪个 zlib1g,但我有“2ubuntu4”版本。我从 Ubuntu 存储库手动下载了该软件包,但是当我使用 Ubuntu 软件打开它时,它仍然无法安装。
错误日志:
foo@foo:/$ sudo apt-get install zlib1g-dev
[sudo] password for foo:
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:
zlib1g-dev : Depends: zlib1g (= 1:1.2.8.dfsg-2ubuntu4) but 1:1.2.8.dfsg-2ubuntu4.1 is to be installed
E: Unable to correct problems, you have held broken packages.
答案1
我在使用 Focal 时也遇到了同样的问题,这是一个默认安装的简单版本:
# apt install zlib1g-dev
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.
zlib1g-dev : Depends: zlib1g (= 1:1.2.11.dfsg-2ubuntu1) but 1:1.2.11.dfsg-2ubuntu1.2 is to be installed
为了zlib1g-dev
进行安装,必须降级zlib1g
,老实说,这对于主存储库中的某些内容来说是荒谬的:
# apt install zlib1g=1:1.2.11.dfsg-2ubuntu1
openssh-server
在首次安装后启动后尝试安装时也发生了类似的问题。