pip加速+百度镜像|清华镜像
針對pip install 安裝包下載慢的問題,主要pip install直接安裝是從國外拉取安裝包。
解決辦法,加國內(nèi)鏡像,比如百度 https://mirror.baidu.com/pypi/simple
比如清華鏡像:https://pypi.tuna.tsinghua.edu.cn/simple
pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple如何加快pip下載的速度
pip 之所以慢,是因?yàn)樗J(rèn)使用的國外的統(tǒng)一的下載源,所以要想加快pip的下載速度,可行的辦法就是切換下載源為國內(nèi),國內(nèi)一些大公司也提供了對應(yīng)的競相網(wǎng)站。
國內(nèi)鏡像網(wǎng)站
-
阿里云 http://mirrors.aliyun.com/pypi/simple/
-
中國科技大學(xué) https://pypi.mirrors.ustc.edu.cn/simple/
-
豆瓣(douban) http://pypi.douban.com/simple/
-
清華大學(xué) https://pypi.tuna.tsinghua.edu.cn/simple/
-
中國科學(xué)技術(shù)大學(xué) http://pypi.mirrors.ustc.edu.cn/simple/
使用方法
pip install [包名] -i [ftp站名地址] --trusted-host [ftp站點(diǎn)名]
- 1
以安裝numpy為例,如果使用 阿里的源可以這樣輸入命令
pip install numpy -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com- 1
如果使用 豆瓣的源可以這樣輸入命令
pip install numpy -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com- 1
其他類似…
如果想一勞永逸或許可以這樣
alias pyinstall='pip install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com '- 1
將這個(gè)alias 放到 /etc/bash.bashrc 或者~/.bashrc中 以后調(diào)用pyinstall 時(shí)就可以不再加后面的參數(shù),而且也省了 install 這個(gè)單詞。
總結(jié)
以上是生活随笔為你收集整理的pip加速+百度镜像|清华镜像的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 论文浅尝 | How to Keep a
- 下一篇: 论文浅尝 | 从 6 篇顶会论文看「知识