所以我想用 apt-get 安装 php7.0-mcrypt
sudo apt-get install php7.0-mcrypt
这是我得到的错误:
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:
php7.0-mcrypt : Depends: php7.0-common (= 7.0.8-0ubuntu0.16.04.3) but 7.0.14-2+deb.sury.org~trusty+1 is to be installed
E: Unable to correct problems, you have held broken packages.
我该怎么办?如何安装 php7.0-common 的 7.0.8-0ubuntu0.16.04.3 版本?
答案1
正如错误所示,由于需要php7.0-common-7.0.8-0ubuntu0.16.04.3
,&之间存在依赖冲突,但是是将要安装的。php7.0-common-7.0.14-2+deb.sury.org~trusty+1
php7.0-mcrypt
7.0.8-0ubuntu0.16.04.3
7.0.14-2+deb.sury.org~trusty+1
使用aptitude
,sudo apt-get install aptitude
为了简单地解决依赖冲突,它会提供执行此操作的选项,
要安装,sudo aptitude install php7.0-mcrypt
请选择适合您的问题的选项,aptitude 会建议几种潜在的解决方案。
答案2
这可能是由于第三方 ppa 的依赖项升级所致。安装 ppa-purge 并使用它来删除不需要的 ppa。(请小心。不要删除必要的 ppa。)通过 ppa-purge 删除它们将降低依赖项的级别,删除并安装一些软件包。(通过其他方法删除它们可能不会这样做。)
sudo apt-get install ppa-purge
sudo ppa-purge ppa:yourppahere
然后执行以下操作:
sudo apt-get install -f
sudo apt autoremove
sudo apt-get install php7.0-mcrypt