1.mac系統本身帶有Python2.7,想要安裝Python3.5,需自行下載並安裝
安裝Python3.5后,需要安裝pip 和setup
2.安裝好pip后安裝selenium,具體命令如下:
pip3 install -U selenium
總是報錯,具體信息如下:
Could not fetch URL https://pypi.python.org/simple/selenium/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:646) - skipping
Could not find a version that satisfies the requirement selenium (from versions: )
No matching distribution found for selenium
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
根據信息提示,需要升級pip, 命令如下
pip install --upgrade pip
依然報錯,具體如下:
Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:646) - skipping
3.解決方法:網絡上看了很多貼紙,最后翻牆發現使用curl來升級pip,命令如下:
curl https://bootstrap.pypa.io/get-pip.py | python3
等待下載完成就可以了,perfect!
再輸入安裝selenium的命令,即可成功。
pip3 install -U selenium
截圖如下:
總結:Python下下載相應的庫時,提示驗證ssh證書是否正確時,使用“curl https://bootstrap.pypa.io/get-pip.py | python3”升級pip,然后再下載安裝即可成功。