一、說在前面
我在用pip下載包時經常有下載比較慢和如下錯誤的問題
Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/pipenv/

二、解決方法
默認pip是使用Python官方的源,但是由於國外官方源經常被牆,導致不可用,我們可以使用國內的python鏡像源,從而解決 Python安裝不上庫的煩惱。
上網也找了很多方法,最后記錄下對我這種錯誤肯定管用的解決方案
關鍵命令:
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 表示將鏡像地址切換為國內,這里切換到了豆瓣
4.--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/ 中國科學技術大學
三、效果

