大家在通過pip 或conda 下載一些很大的第三方庫時是不是有一種等到墳頭的草都三尺高了,還沒下載完的感覺,而且大的第三方庫長時間下載,可能會導致超時自動中斷下載,感謝清華的大佬們
臨時使用:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow
每次下載時,默認使用此鏡像:
需將pip升級到最新的版本,>=10.0.0
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
有問題請留言,歡迎指點!!!
今天又試了一下發現有問題。
如果以上方法不行的話:
請使用:
轉自:https://www.cnblogs.com/cqliu/p/11131092.html
國內鏡像源
清華: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/
臨時使用
在使用pip的時候加參數-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider,這樣就會從清華這邊的鏡像去安裝pyspider庫。
一勞永逸
Linux下,修改 ~/.pip/pip.conf (沒有就創建一個文件夾及文件。文件夾要加“.”,表示是隱藏文件夾)
內容如下:
[global] index-url = http://mirrors.aliyun.com/pypi/simple/ [install] trusted-host=mirrors.aliyun.com
windows下,直接在user目錄中創建一個pip目錄,如:C:\Users\xx\pip,新建文件pip.ini。內容同上。
本機win10操作系統,目錄:C:\Users\DELL\AppData\Roaming\pip\pip.ini
遇到的問題
實際使用的時候,一開始使用清華的鏡像,在安裝時,總是提示
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
換了阿里的鏡像之后,問題得到了解決。
以后會持續更新。