为什么通过 yum 安装 pip 时 pip 版本不是最新的

为什么通过 yum 安装 pip 时 pip 版本不是最新的

我们尝试通过以下方式安装最新版本的 pip (我们有 rhel 7.6 服务器和 python 2.7 )

yum install python27-python-pip
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
rhel-7-server-rpms                                                                                                                                                    | 3.5 kB  00:00:00
rhel-server-rhscl-7-rpms                                                                                                                                              | 3.4 kB  00:00:00
(1/6): rhel-7-server-rpms/7Server/x86_64/group                                                                                                                        | 631 kB  00:00:00
(2/6): rhel-7-server-rpms/7Server/x86_64/updateinfo                                                                                                                   | 3.9 MB  00:00:01
(3/6): rhel-server-rhscl-7-rpms/7Server/x86_64/group                                                                                                                  |  124 B  00:00:00
(4/6): rhel-server-rhscl-7-rpms/7Server/x86_64/updateinfo                                                                                                             | 1.1 MB  00:00:00
(5/6): rhel-server-rhscl-7-rpms/7Server/x86_64/primary_db                                                                                                             | 6.0 MB  00:00:07
(6/6): rhel-7-server-rpms/7Server/x86_64/primary_db                                                                                                                   |  75 MB  00:00:11
Resolving Dependencies
--> Running transaction check
---> Package python27-python-pip.noarch 0:8.1.2-3.el7 will be installed
--> Processing Dependency: python27-python(abi) = 2.7 for package: python27-python-pip-8.1.2-3.el7.noarch
--> Processing Dependency: /opt/rh/python27/root/usr/bin/python2 for package: python27-python-pip-8.1.2-3.el7.noarch
--> Processing Dependency: python27-python-setuptools for package: python27-python-pip-8.1.2-3.el7.noarch
--> Processing Dependency: python27-runtime for package: python27-python-pip-8.1.2-3.el7.noarch
--> Running transaction check
---> Package python27-python.x86_64 0:2.7.17-2.el7 will be installed
--> Processing Dependency: python27-python-libs(x86-64) = 2.7.17-2.el7 for package: python27-python-2.7.17-2.el7.x86_64
---> Package python27-python-setuptools.noarch 0:0.9.8-7.el7 will be installed
---> Package python27-runtime.x86_64 0:1.1-26.1.el7 will be installed
--> Running transaction check
---> Package python27-python-libs.x86_64 0:2.7.17-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================
 Package                                               Arch                              Version                                   Repository                                           Size
=============================================================================================================================================================================================
Installing:
 python27-python-pip                                   noarch                            8.1.2-3.el7                               rhel-server-rhscl-7-rpms                            1.7 M
Installing for dependencies:
 python27-python                                       x86_64                            2.7.17-2.el7                              rhel-server-rhscl-7-rpms                             87 k
 python27-python-libs                                  x86_64                            2.7.17-2.el7                              rhel-server-rhscl-7-rpms                            5.8 M
 python27-python-setuptools                            noarch                            0.9.8-7.el7                               rhel-server-rhscl-7-rpms                            400 k
 python27-runtime                                      x86_64                            1.1-26.1.el7                              rhel-server-rhscl-7-rpms                            1.1 M

Transaction Summary
=============================================================================================================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 9.1 M
Installed size: 34 M
Is this ok [y/d/N]: n

由于 yum 从 rhel repo 下载非常旧的版本 8.1.x

然后我们从 epel repo 尝试如下

yum  install python-pip
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
epel/x86_64/metalink                                                                                                                                                  |  22 kB  00:00:00
epel                                                                                                                                                                  | 4.7 kB  00:00:00
(1/3): epel/x86_64/group_gz                                                                                                                                           |  95 kB  00:00:00
epel/x86_64/updateinfo         FAILED
https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/7/x86_64/repodata/26aa3fe31b7a3b4fd3c1865e5a8635f296b1a9c3591a936744c4226a7b170089-updateinfo.xml.bz2: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

(2/3): epel/x86_64/updateinfo                                                                                                                                         | 1.0 MB  00:00:00
(3/3): epel/x86_64/primary_db                                                                                                                                         | 6.9 MB  00:00:11
Resolving Dependencies
--> Running transaction check
---> Package python2-pip.noarch 0:8.1.2-14.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================
 Package                                         Arch                                       Version                                           Repository                                Size
=============================================================================================================================================================================================
Installing:
 python2-pip                                     noarch                                     8.1.2-14.el7                                      epel                                     1.7 M

Transaction Summary
=============================================================================================================================================================================================
Install  1 Package

Total download size: 1.7 M
Installed size: 7.2 M
Is this ok [y/d/N]: n

但同样从epel回购协议中我们有非常旧的 pip 版本 - 8.1.2

那么是我的程序有问题吗?

如果是,那么如何安装最新的 pip 版本?

答案1

你没有做错什么,8.1.2 是 EPEL 7 存储库中可用的 pip 的最新版本。 RHEL/CentOS 7 通常不会获得新版本的软件,只会修复错误,EPEL 也是如此。有一些 CVE 修复和其他最新补丁pip EPEL 存储库所以我认为它正在得到积极维护并且可以安全使用。

答案2

8.1.2 是 RHEL 7.6(以及 RHEL 7.8)的 RHEL 存储库中提供的最新版本,对应的 Python 版本为 2.7。版本 19.3.1 可用,但适用于 Python 3.8。如果启用必要的 RHEL 存储库并使用yum以下命令搜索软件包,您可以看到它可用:

subscription-manager repos enable rhel*
yum list available | grep python-pip

这将向您显示所有可用 Python 版本的最新版本,包括 Python 2.7 的 8.1.2 和 Python 3.8 的 19.3.1。

如果您想要版本 21.x,那么您需要安装更高版本的 Python,例如 3.8。 Python 2.7 不再受支持,也不会再收到更新。

相关内容