使用Anaconda中的pip命令报错:pip is configured with locations that require TLS/SSL
错误内容
1 2 3 4 5 6 7 8 9 10 |
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Collecting jupyterthemes 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/jupyterthemes/ 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/jupyterthemes/ 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/jupyterthemes/ 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/jupyterthemes/ 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/jupyterthemes/ Could not fetch URL https://pypi.org/simple/jupyterthemes/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.org’, port=443): Max retries exceeded with url: /simple/jupyterthemes/ (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 jupyterthemes (from versions: ) No matching distribution found for jupyterthemes |
解决方案
最开始在网上搜索同类问题,大都是说python 的ssl模块未安装,从问题描述来看确实也很像,但是他们的问题大多发生在Linux上,而我的是Windows,又联想到Anaconda本来就是一个Python的套件包,包含了许多常用的工具和Python库,不可能犯这种低级错误,所以很可能是环境变量未配置全,导致pip无法找到ssl相关模块。
最终参考之前正常的Anaconda的配置,将”[Anaconda安装目录]\Library\bin”加入PATH后,问题解决。
————————————————
参考链接:https://blog.csdn.net/JerkSpan/article/details/86599690