pip install第三方包 Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/pipenv/:【解決方案】

pip instal xxx 的時候總是報如下錯誤

 Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/pipenv/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Max retries exceeded with url: /simple/pipenv/ 

 默認pip是使用Python官方的源,但是由於國外官方源經常被牆,導致不可用,我們可以使用國內的python鏡像源,從而解決

 Python安裝不上庫的煩惱。

上網也找了很多方法,最後記錄下對我這種錯誤肯定管用的解決方案,親測有效~

  關鍵命令如下:

C:\Users\Administrator>pip install xxx -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

  做一下解釋:

     1. pip install 表示通過pip 來安裝某種包

     2. xxx     表示你要安裝的包名,比如pipenv,jupyter等等

     3. -i http://pypi.douban.com/simple       表示將鏡像地址切換爲國內,這裏切換到了豆瓣

常用的鏡像地址有: 

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.--trusted-host pypi.douban.com    表示將指定網站設置爲信任服務器

最後附上一張成功截圖:

 

  祝大家安裝成功!!!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章