我正在使用运行 Linux 6 的旧服务器。我被要求在计算机上安装 aws-CLI,以便我们开始将文件直接保存到 s3 存储桶。这需要 python 3.4 或更高版本(从 2020 年 1 月开始)。
第一次尝试后,我收到以下错误:
# pip3 install awscli --upgrade --user
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting awscli
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/awscli/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/awscli/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/awscli/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/awscli/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/awscli/
Could not fetch URL https://pypi.org/simple/awscli/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/awscli/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement awscli (from versions: none)
ERROR: No matching distribution found for awscli
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
基本上 SSL 包丢失了。我从 YUM 安装了一些软件包并重新运行./配置、制作、和进行安装并且仍然存在 SSL 模块错误。
在一些帖子和博客的帮助下,我现在能够在看到 SSL 包但未导入的情况下收到此错误。此时我已经能够从源代码安装Python-3.8。在此期间制作过程我看到以下几行。
# ./configure --with-openssl=/usr/src/openssl-1.0.2o --enable-optimizations
# make
Following modules built successfully but were removed because they could not be imported:
_hashlib _ssl
Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
然后尝试在 Python 中导入该包,我得到以下信息:
python3.8
Python 3.8.0 (default, Oct 17 2019, 10:40:08)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
>>> exit()
我可以尝试实现在 RHEL6 上安装 aws-cli 的最终目标吗?请包括我需要清理/卸载当前可能存在的任何混乱的任何步骤。
我尝试过的参考资料:
答案1
openssl
我遇到了同样的问题,并通过将库的路径添加到rpath
:
LDFLAGS=-Wl,-rpath=/usr/src/openssl-1.0.2o/lib
./configure --with-openssl=/usr/src/openssl-1.0.2o --enable-optimizations
make
答案2
您可能会在 IUScommunity 上找到可以安装在 Centos 6 系统上的 Python >3.4 的 rpm。 (Google 获取他们的 URL。)这将绕过尝试从头开始编译 Python 所导致的问题。
除了在过去几个月使用过他们的 yum 存储库之外,我与他们没有任何联系。