pip源的更改:
pip的默認源在國外,pip install some_packages特別慢,經常會超時,導致安裝失敗;
pip 更換為國內的鏡像
一:使用方法:
①臨時使用:
1 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple “你要下載的庫名”
②永久修改:
(1)linux:
修改 ~/.pip/pip.conf (沒有就創建一個), 內容如下:
1 [global] 2 index-url = https://pypi.tuna.tsinghua.edu.cn/simple12
(2)windows:
直接在user目錄中創建一個pip目錄,如:C:\Users\xx\pip,新建文件pip.ini,內容如下
1 [global] 2 index-url = https://pypi.tuna.tsinghua.edu.cn/simple
二:常用鏡像:
阿里雲 http://mirrors.aliyun.com/pypi/simple/
中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清華大學 https://pypi.tuna.tsinghua.edu.cn/simple/
中國科學技術大學 http://pypi.mirrors.ustc.edu.cn/simple/
三:下載超時
1 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --default-timeout=100 “你要下載的庫名”