为什么默认安装建议的软件包?

为什么默认安装建议的软件包?

当我发现通过安装时firefoxdriver,chromium 的东西也会被安装时,我感到很惊讶:

$ sudo apt install firefoxdriver 
[sudo] password for asuka: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  chromium-browser chromium-chromedriver python3-selenium
The following NEW packages will be installed:
  chromium-browser chromium-chromedriver firefoxdriver python3-selenium
0 upgraded, 4 newly installed, 0 to remove and 7 not upgraded.
Need to get 802 kB of archives.
After this operation, 1,645 kB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.

我深入研究后发现,这firefoxdriver取决于python3-selenium

$ apt show firefoxdriver 
Package: firefoxdriver

...

Depends: libc6 (>= 2.4), firefox-esr | firefox, python-selenium (>= 3.14.1) | python3-selenium (>= 3.14.1)

...

python3-selenium建议,我猜这就是引入铬包的chromium-driver原因。firefoxdriver

$ apt show python3-selenium
Package: python3-selenium

...

Recommends: chromium-driver | chromedriver | phantomjs

...

我的猜测正确吗?如果正确,为什么默认安装推荐的软件包?

答案1

Recommends并且Suggests是不同的类别。

您的输出显示Recommends(不是Suggests)。

Ubuntu 的默认设置是安装Recommends和不安装Suggests。您可以按照以下方法查看当前设置:

$ apt-config dump | grep Suggests
APT::Install-Suggests "0";         // 0 = No

$ apt-config dump | grep Recommends
APT::Install-Recommends "1";       // 1 = Yes

当然,您可以通过多种方式更改设置。

进行一次性更改的最简单方法是使用 apt 的--no-install-recommends标志。例如:sudo apt install hello --no-install-recommends

对于大多数人来说,进行频繁更改的最简单方法是使用文件更改设置/etc/apt/apt.conf.d/

相关内容