在使用Python開發程序中,經常要用pip安裝軟體包,但是直接使用pip install packagename經常慢得要死,而且慢就算了很多時候還下載完成安裝失敗,
問題原因
pip默認使用的是國外源(https://pypi.org/simple),由于眾所周知的原因,訪問一般都會很慢,
解決方案
使用國內源,
臨時方法
在命令列里面加上 -i https://pypi.tuna.tsinghua.edu.cn/simple
一勞永逸的方法
直接在user目錄中創建一個pip目錄,如:C:\Users\xx\pip,新建檔案pip.ini,(這里針對Windows系統)
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple [install] trusted-host=mirrors.aliyun.com
國內源記錄
清華:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/
華中理工大學:http://pypi.hustunique.com/
山東理工大學:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
本文來自博客園,作者:Arthurian,轉載請注明原文鏈接:https://www.cnblogs.com/Arthurian/p/16612448.html
歡迎郵件交流:[email protected]
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/502966.html
標籤:Python
上一篇:行程、執行緒補充與協程相關介紹
