解决错误:pip is configured with locations that require TLS/SSL,the ssl module in Python is not available。

pip安装包出现错误类似如下:

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting protobuf>=4.25.2 (from -r requirements.txt (line 3)) 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/protobuf/ 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/protobuf/ 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/protobuf/ 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/protobuf/ 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/protobuf/ Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/protobuf/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.tuna.tsinghua.edu.cn’, port=443): Max retries exceeded with url: /simple/protobuf/ (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 protobuf>=4.25.2 (from -r requirements.txt (line 3)) (from versions: none) ERROR: No matching distribution found for protobuf>=4.25.2 (from -r requirements.txt (line 3)) 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.tuna.tsinghua.edu.cn/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.tuna.tsinghua.edu.cn’, 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

或者如下错误:

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Collecting protobuf>=4.25.2 (from -r requirements.txt (line 3)) 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/protobuf/ 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/protobuf/ 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/protobuf/ 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/protobuf/ 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/protobuf/ Could not fetch URL https://pypi.org/simple/protobuf/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.org’, port=443): Max retries exceeded with url: /simple/protobuf/ (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 protobuf>=4.25.2 (from -r requirements.txt (line 3)) (from versions: none) ERROR: No matching distribution found for protobuf>=4.25.2 (from -r requirements.txt (line 3)) 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

解决方法:

yum -y install openssl-devel

之后重新编译一下Python即可,不需要重新建立软连接。

或者卸载 python之后 重新安装一下。

升级pip:

pip38 install --upgrade pip

好文推荐

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: