使用pip安装pymysql出错;
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting PyMySQL
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/pymysql/
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/pymysql/
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/pymysql/
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/pymysql/
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/pymysql/
Could not fetch URL https://pypi.org/simple/pymysql/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pymysql/ (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 PyMySQL (from versions: )
No matching distribution found for PyMySQL
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
使用pip安装其他模块时也可能出现上述错误,主要原因是网络的问题,需要使用国内的镜像源来加速,比如豆瓣源
因此命令可以使用:
pip install pymysql -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
或者
pip3 install pymysql -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
即可成功安装。
转自:https://www.cnblogs.com/kadima-zy/p/python_pip.html
本文链接:https://blog.csdn.net/Felix_CB/article/details/92377708