无法在 RHEL 上安装 python 2.7

无法在 RHEL 上安装 python 2.7

我无法在 RHEL8 中安装 python 2.7。我在 Centos7 存储库之外找不到 python 包已经让我很困扰,但是当我尝试安装时,出现了大量损坏的依赖项:

sudo dnf install python

给我:

Last metadata expiration check: 0:09:54 ago on Thu 05 Aug 2021 09:35:23 PM CDT.
Error: 
 Problem: package mod_ssl-1:2.4.37-10.module+el8+2764+7127e69e.x86_64 requires libcrypto.so.1.1()(64bit), but none of the providers can be installed
  - package mod_ssl-1:2.4.37-10.module+el8+2764+7127e69e.x86_64 requires libcrypto.so.1.1(OPENSSL_1_1_0)(64bit), but none of the providers can be installed
  - package mod_ssl-1:2.4.37-10.module+el8+2764+7127e69e.x86_64 requires libssl.so.1.1()(64bit), but none of the providers can be installed
  - package mod_ssl-1:2.4.37-10.module+el8+2764+7127e69e.x86_64 requires libssl.so.1.1(OPENSSL_1_1_0)(64bit), but none of the providers can be installed
  - package mod_ssl-1:2.4.37-10.module+el8+2764+7127e69e.x86_64 requires libssl.so.1.1(OPENSSL_1_1_1)(64bit), but none of the providers can be installed
  - cannot install both openssl-libs-1:1.0.2k-19.el7.x86_64 and openssl-libs-1:1.1.1g-15.el8_3.x86_64
  - problem with installed package mod_ssl-1:2.4.37-10.module+el8+2764+7127e69e.x86_64
  - package python-libs-2.7.5-89.el7.x86_64 requires libcrypto.so.10()(64bit), but none of the providers can be installed
  - package python-libs-2.7.5-89.el7.x86_64 requires libcrypto.so.10(libcrypto.so.10)(64bit), but none of the providers can be installed
  - package python-libs-2.7.5-89.el7.x86_64 requires libssl.so.10()(64bit), but none of the providers can be installed
  - package python-libs-2.7.5-89.el7.x86_64 requires libssl.so.10(libssl.so.10)(64bit), but none of the providers can be installed
  - package python-libs-2.7.5-89.el7.x86_64 requires libcrypto.so.10(OPENSSL_1.0.1_EC)(64bit), but none of the providers can be installed
  - package python-libs-2.7.5-89.el7.x86_64 requires libcrypto.so.10(OPENSSL_1.0.2)(64bit), but none of the providers can be installed
  - package mod_ssl-1:2.4.6-95.el7.centos.x86_64 requires httpd = 2.4.6-95.el7.centos, but none of the providers can be installed
  - package python-2.7.5-89.el7.x86_64 requires libpython2.7.so.1.0()(64bit), but none of the providers can be installed
  - package python-2.7.5-89.el7.x86_64 requires python-libs(x86-64) = 2.7.5-89.el7, but none of the providers can be installed
  - package mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64 conflicts with httpd < 2.4.25-8 provided by httpd-2.4.6-95.el7.centos.x86_64
  - conflicting requests
  - problem with installed package mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

当我尝试sudo dnf install python --allowerasing 时,我得到:

Last metadata expiration check: 0:22:11 ago on Thu 05 Aug 2021 09:35:23 PM CDT.
Error: 
 Problem: The operation would result in removing the following protected packages: dnf
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

这听起来不太好。

sudo dnf install python --nobest --skip-broken

然后:

Last metadata expiration check: 0:11:50 ago on Thu 05 Aug 2021 09:35:23 PM CDT.
Dependencies resolved.

 Problem: package mod_ssl-1:2.4.37-10.module+el8+2764+7127e69e.x86_64 requires libcrypto.so.1.1()(64bit), but none of the providers can be installed
  - package mod_ssl-1:2.4.37-10.module+el8+2764+7127e69e.x86_64 requires libcrypto.so.1.1(OPENSSL_1_1_0)(64bit), but none of the providers can be installed
  - package mod_ssl-1:2.4.37-10.module+el8+2764+7127e69e.x86_64 requires libssl.so.1.1()(64bit), but none of the providers can be installed
  - package mod_ssl-1:2.4.37-10.module+el8+2764+7127e69e.x86_64 requires libssl.so.1.1(OPENSSL_1_1_0)(64bit), but none of the providers can be installed
  - package mod_ssl-1:2.4.37-10.module+el8+2764+7127e69e.x86_64 requires libssl.so.1.1(OPENSSL_1_1_1)(64bit), but none of the providers can be installed
  - cannot install both openssl-libs-1:1.0.2k-19.el7.x86_64 and openssl-libs-1:1.1.1g-15.el8_3.x86_64
  - problem with installed package mod_ssl-1:2.4.37-10.module+el8+2764+7127e69e.x86_64
  - package python-libs-2.7.5-89.el7.x86_64 requires libcrypto.so.10()(64bit), but none of the providers can be installed
  - package python-libs-2.7.5-89.el7.x86_64 requires libcrypto.so.10(libcrypto.so.10)(64bit), but none of the providers can be installed
  - package python-libs-2.7.5-89.el7.x86_64 requires libssl.so.10()(64bit), but none of the providers can be installed
  - package python-libs-2.7.5-89.el7.x86_64 requires libssl.so.10(libssl.so.10)(64bit), but none of the providers can be installed
  - package python-libs-2.7.5-89.el7.x86_64 requires libcrypto.so.10(OPENSSL_1.0.1_EC)(64bit), but none of the providers can be installed
  - package python-libs-2.7.5-89.el7.x86_64 requires libcrypto.so.10(OPENSSL_1.0.2)(64bit), but none of the providers can be installed
  - package mod_ssl-1:2.4.6-95.el7.centos.x86_64 requires httpd = 2.4.6-95.el7.centos, but none of the providers can be installed
  - package python-2.7.5-89.el7.x86_64 requires libpython2.7.so.1.0()(64bit), but none of the providers can be installed
  - package python-2.7.5-89.el7.x86_64 requires python-libs(x86-64) = 2.7.5-89.el7, but none of the providers can be installed
  - package mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64 conflicts with httpd < 2.4.25-8 provided by httpd-2.4.6-95.el7.centos.x86_64
  - conflicting requests
  - problem with installed package mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64
==================================================================================================================================
 Package                        Arch                     Version                                  Repository                 Size
==================================================================================================================================
Skipping packages with conflicts:
(add '--best --allowerasing' to command line to force their upgrade):
 httpd                          x86_64                   2.4.6-95.el7.centos                      centos7                   2.7 M
 openssl-libs                   x86_64                   1:1.0.2k-19.el7                          centos7                   1.2 M
Skipping packages with broken dependencies:
 mod_ssl                        x86_64                   1:2.4.6-95.el7.centos                    centos7                   114 k
 python                         x86_64                   2.7.5-89.el7                             centos7                    96 k
 python-libs                    x86_64                   2.7.5-89.el7                             centos7                   5.6 M

Transaction Summary
==================================================================================================================================
Skip  5 Packages

Nothing to do.
Complete!

当然,Python也不是生产出来的。我不知道该怎么做。我还有其他选择来安装 python 吗? (我需要 python,而不是 python3,因为我尝试运行的可执行文件/脚本是用 python 编写的,如果将 python 别名为 python3,我会收到各种错误)。是否有适用于 python 2.7 的 rpm 包不会成为依赖项噩梦?

答案1

Python 2.7 是可在 RHEL 8 AppStream 存储库中找到(包裹python2)。请不要合并 RHEL/CentOS 不同主要版本的存储库,这不受支持,而且正如您所见,这是不可能的。

# dnf info python2
Available Packages
Name         : python2
Version      : 2.7.18
Release      : 6.module_el8.5.0+772+8dae0bfd
Architecture : x86_64
Size         : 109 k
Source       : python2-2.7.18-6.module_el8.5.0+772+8dae0bfd.src.rpm
Repository   : appstream
Summary      : An interpreted, interactive, object-oriented programming language
...

请注意,官方支持 Python 2于2020年结束红帽将提供安全更新仅到 2024 年

相关内容