所以 apt-get 再次让我烦恼的是包安装失败的臭名昭著的消息,因为依赖项“不会被安装”:
~ $ sudo apt-get install php-apcu
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:
php-apcu : Depends: phpapi-20151012
Recommends: php-apcu-bc but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)
据我了解,默认是安装所有缺少的依赖项以及请求的包。什么会导致 apt-get 拒绝安装某些依赖项?(如果导致这种情况的原因不止一件事,我怎样才能找出是哪一件?)
TL;DR: <foobar> is not going to be installed
暗示<foobar>
依赖本身具有某些由于某种原因无法满足的依赖。
重新运行apt-get
并在命令行中明确包含有问题的依赖项应该可以让您更好地了解问题所在。
在上述情况下,我得到了这个:
~ $ sudo apt-get install php-apcu php-apcu-bc
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:
php-apcu : Depends: phpapi-20151012
php-apcu-bc : Depends: phpapi-20151012
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)
和:
~ $ sudo apt-get install php-apcu php-apcu-bc phpapi-20151012
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package phpapi-20151012 is a virtual package provided by:
php7.0-phpdbg 7.0.22-3
php7.0-fpm 7.0.22-3
php7.0-cli 7.0.22-3
php7.0-cgi 7.0.22-3
libphp7.0-embed 7.0.22-3
libapache2-mod-php7.0 7.0.22-3
You should explicitly select one to install.
E: Package 'phpapi-20151012' has no installation candidate
Run Code Online (Sandbox Code Playgroud)
所以这里的问题是最初请求的包php-apcu
依赖于php-apcu-bc
,而后者又依赖于phpapi-20151012
. 后者不是可直接安装的包,而是多个包提供的特性,因此apt-get无法自动判断需要安装什么。
在这个特定案例中的根本原因是我试图php-apcu
在运行 PHP5 的系统上安装一个 PHP7 包,正确的包是php5-apcu
.
归档时间: |
|
查看次数: |
14704 次 |
最近记录: |