问题产生背景
- 在mac系统中,需要用pip 安装MySQLdb库,直接执行
sudo pip install MySQL-python
报了如下的错误:
Could not fetch URL https://pypi.python.org/simple/mysql-python/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661) - skipping
Could not find a version that satisfies the requirement MySQL-python (from versions: )
No matching distribution found for MySQL-python
原因分析
原因是python.org已经不支持TLSv1.0和TLSv1.1了。更新pip可以解决这个问题。
解决方案
mac或者linux操作系统:在终端下执行命令:
curl https://bootstrap.pypa.io/get-pip.py | python
注意点: 必须用root身份执行此命令。