解決 ‘Could not fetch URL https://pypi.python.org’的問題

【前提】:python

win10下python3和python2共存環境,可是環境變量只配置了python3fetch

【問題】:阿里雲

用pip安裝一個包
執行pip2 install xxx的時候報錯
Fatal error in launcher: Unable to create process using '"'url

執行pip3 install xxx的時候報一樣的錯誤
Fatal error in launcher: Unable to create process using '"'spa

【解決】:
python2 -m pip install XXX
python3 -m pip install XXXblog

報了新的錯誤 :ip

Could not fetch URL https://pypi.org/simple/xlsxwriter/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/xlsxwriter/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056)'))) - skippingssl

研究了很久只知道是證書的錯誤~按照網上的各類指導嘗試了以下方案get

1.第一種嘗試方式:直接下載get-pip.py文件,執行命令python get-pip.py 結果是:失敗it

2.第二種嘗試方式:加上--trusted-host 執行 pip --trusted-host pypi.python.org install xxx 結果是:失敗

3.第三種嘗試:發現是url的來源的問題,換成了國內的pip源就能夠正常安裝了,我使用的是:pip install xlrd -i http://pypi.douban.com/simple --trusted-host pypi.douban.com,結果:失敗

1)http://mirrors.aliyun.com/pypi/simple/ 阿里雲

2)https://pypi.mirrors.ustc.edu.cn/simple/  中國科技大學

3) http://pypi.douban.com/simple/  豆瓣

4) https://pypi.tuna.tsinghua.edu.cn/simple/ 清華大學

5)  http://pypi.mirrors.ustc.edu.cn/simple/ 中國科學技術大學

4.第四種嘗試:思考了一下混合了兩個問題的解決方法,使用命令python -m pip install xlsxwriter  --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org ,結果:成功

 

相關文章
相關標籤/搜索