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

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

码农世界 2024-06-08 后端 80 次浏览 0个评论

解决错误: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

转载请注明来自码农世界,本文标题:《解决错误:pip is configured with locations that require TLS/SSL,the ssl module in Python is not available》

百度分享代码,如果开启HTTPS请参考李洋个人博客
每一天,每一秒,你所做的决定都会改变你的人生!

发表评论

快捷回复:

评论列表 (暂无评论,80人围观)参与讨论

还没有评论,来说两句吧...

Top