为什么 python-pip 保留在 Ubuntu 14.04 中?

为什么 python-pip 保留在 Ubuntu 14.04 中?

这些天当我升级时,我收到此消息:

$ sudo apt-get upgrade -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  libhwloc-plugins linux-headers-generic linux-signed-generic
  linux-signed-image-generic python-pip
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.

我不明白为什么python-pip它被保留了下来。是不是因为我pip已经更新过了?

$ pip -V
pip 7.0.3 from /usr/local/lib/python2.7/dist-packages (python 2.7)

现在升级安全吗python-pipapt-get


更新:

$ sudo apt-get install python-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  python-chardet-whl python-colorama-whl python-distlib-whl
  python-html5lib-whl python-pip-whl python-requests-whl python-setuptools-whl
  python-six-whl python-urllib3-whl
Recommended packages:
  python-dev-all python-wheel
The following NEW packages will be installed:
  python-chardet-whl python-colorama-whl python-distlib-whl
  python-html5lib-whl python-pip-whl python-requests-whl python-setuptools-whl
  python-six-whl python-urllib3-whl
The following packages will be upgraded:
  python-pip
1 upgraded, 9 newly installed, 0 to remove and 4 not upgraded.
Need to get 1,193 kB of archives.
After this operation, 1,438 kB of additional disk space will be used.

答案1

当某个软件包被标记为“保留”时,这意味着 apt 将不会自动更新它,因为它现在有一个您从未同意安装的新额外依赖项。当您使用 专门安装它时sudo apt-get install python-pip,它会返回一条消息,指出将安装以下软件包以满足依赖项要求:

python-chardet-whl python-colorama-whl python-distlib-whl 
python-html5lib-whl python-pip-whl python-requests-whl python-setuptools-whl
python-six-whl python-urllib3-whl

这些都是您系统上不存在的新软件包。apt 不会假设您想要安装它们,而是“保留”这些软件包,直到您明确告诉它安装它们。如果您不介意安装这些新软件包(您可能不介意),请同意安装。

如果您想要升级所有内容,并且不介意安装任何新的依赖项,则该命令sudo apt-get dist-upgrade将安装所有升级并引入更新包所需的任何新依赖项。请小心,因为有时新的依赖项意味着整个软件包都会被引入(例如,gnome-desktop需要下载和安装一堆依赖项)。

答案2

在你的情况下运行

sudo apt-get dist-upgrade

代替

sudo apt-get upgrade

要了解差异,请阅读手册页:

man apt-get

upgrade

Used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list(5). Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, nor are packages that are not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. An update must be performed first so that apt-get knows that new versions of packages are available.

dist-upgrade

In addition to performing the function of upgrade, this option also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones, if necessary.
The /etc/apt/sources.list(5) file contains a list of locations from which to retrieve desired package files. See also apt_preferences(5) for a mechanism for over-riding the general settings for individual packages.

相关内容