我已经安装了 python 3.7 和 pip,但是运行 pip 出现错误:
pip3.7 install django
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting django
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/django/
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/django/
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/django/
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/django/
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/django/
Could not fetch URL https://pypi.org/simple/django/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/django/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Could not find a version that satisfies the requirement django (from versions: )
No matching distribution found for django
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
我还尝试安装 openssl-devel:
[email protected] [tmp]# yum install openssl-devel
Loaded plugins: fastestmirror, security, universal-hooks
Setting up Install Process
Loading mirror speeds from cached hostfile
* EA4: 70.87.220.252
* cpanel-addons-production-feed: 70.87.220.252
* cpanel-plugins: 70.87.220.252
Package openssl-devel-1.0.1e-57.el6.x86_64 already installed and latest version
Nothing to do
但这没有任何作用。
基本上,我正在尝试为 Web 服务器安装 django,但 ssl 问题阻止了这一点。什么是修复或更好的路径?抱歉我的天真。
另外,我发现的所有说明均适用于 python 2.x 或较新的 RHEL 版本。我看过https://developers.redhat.com/blog/2018/08/13/install-python3-rhel/但我不太了解它,无法尝试它并且不会破坏任何东西,因为该服务器正在使用。