問題產(chǎn)生背景
- 在mac系統(tǒng)中,需要用pip 安裝MySQLdb庫,直接執(zhí)行
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已經(jīng)不支持TLSv1.0和TLSv1.1了赠尾。更新pip可以解決這個問題厘肮。
解決方案
mac或者linux操作系統(tǒng):在終端下執(zhí)行命令:
curl https://bootstrap.pypa.io/get-pip.py | python
注意點: 必須用root身份執(zhí)行此命令。