![apt-rdepends 和 apt-get install 输出的区别](https://linux22.com/image/1095450/apt-rdepends%20%E5%92%8C%20apt-get%20install%20%E8%BE%93%E5%87%BA%E7%9A%84%E5%8C%BA%E5%88%AB.png)
当我发出命令时apt-rdepends -p python-epydoc | grep NotInstalled
,我得到以下输出
$ apt-rdepends -p python-epydoc | grep NotInstalled
Reading package lists... Done
Building dependency tree
Reading state information... Done
Depends: debconf-2.0 [NotInstalled]
Depends: debconf-english [NotInstalled]
PreDepends: perlapi-5.10.0 [NotInstalled]
Depends: perlapi-5.10.0 [NotInstalled]
Depends: perlapi-5.10.0 [NotInstalled]
Depends: debconf-2.0 [NotInstalled]
Depends: debconf-2.0 [NotInstalled]
当我发出sudo apt-get install python-epydoc
$ sudo apt-get install python-epydoc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
blt graphviz lacheck latex-beamer latex-xcolor lmodern luatex pgf preview-latex-style prosper ps2eps python-docutils python-lxml python-pygments python-roman
python-tk tcl8.5 tex-common texlive-base texlive-binaries texlive-common texlive-doc-base texlive-extra-utils texlive-font-utils texlive-fonts-recommended
texlive-fonts-recommended-doc texlive-generic-recommended texlive-latex-base texlive-latex-base-doc texlive-latex-extra texlive-latex-extra-doc
texlive-latex-recommended texlive-latex-recommended-doc texlive-luatex texlive-pictures texlive-pictures-doc texlive-pstricks texlive-pstricks-doc tipa tk8.5
Suggested packages:
blt-demo graphviz-doc auctex texlive-lang-french epydoc-doc python-profiler python-lxml-dbg python-chardet tix python-tk-dbg tclreadline debhelper perl-tk dvidvi
fragmaster latexmk xindy purifyeps psutils t1utils texpower
The following NEW packages will be installed:
blt graphviz lacheck latex-beamer latex-xcolor lmodern luatex pgf preview-latex-style prosper ps2eps python-docutils python-epydoc python-lxml python-pygments
python-roman python-tk tcl8.5 tex-common texlive-base texlive-binaries texlive-common texlive-doc-base texlive-extra-utils texlive-font-utils
texlive-fonts-recommended texlive-fonts-recommended-doc texlive-generic-recommended texlive-latex-base texlive-latex-base-doc texlive-latex-extra
texlive-latex-extra-doc texlive-latex-recommended texlive-latex-recommended-doc texlive-luatex texlive-pictures texlive-pictures-doc texlive-pstricks
texlive-pstricks-doc tipa tk8.5
0 upgraded, 41 newly installed, 0 to remove and 68 not upgraded.
Need to get 370MB/436MB of archives.
After this operation, 724MB of additional disk space will be used.
Do you want to continue [Y/n]?
输出apt-get install
表明我必须安装命令未给出的包apt-rdepends -p python-epydoc | grep NotInstalled
。
前一个命令中的软件包和后一个命令中要安装的软件包不应该NotInstalled
是相同的吗? 如果是,那么造成这种差异的原因是什么?
答案1
从 Ubuntu 8.10 开始,apt 默认不仅安装严格依赖项,还安装推荐的软件包。如果您不想让 apt-get 安装推荐的软件包,可以使用标志 --no-install-recommends
apt-get install --no-install-recommends python-epydoc
您还可以通过设置 APT::Install-Recommends "false"; 使该设置持久化。它可以位于 /etc/apt/apt.conf 中,也可以位于 /etc/apt/apt.conf.d/ 下的专用文件中。另请参阅 8.10 发行说明的以下部分。
https://wiki.ubuntu.com/IntrepidReleaseNotes#Recommended_packages_installed_by_default
您可以告诉 apt-rdepends 也关注并显示推荐。这将为您提供更完整的输出。请注意,它将包含相当多的重复项等。
apt-rdepends -p --follow=1,2,4 --show=Depends,PreDepends,Recommends python-epydoc | grep NotInstalled
我使用 --follow=1,2,4 而不是实际命名 Depends、PreDepends 和 Recommends 的原因是Launchpad 错误 #315567