pip 使用镜像下载第三方包

  • pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple 包名

  •  
  • 例如:

  •  
  • pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas

国内源:

清华: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的下载源更换为国内的镜像源。

下载慢是因为pip默认下载源在国外。

换成国内各个优秀的镜像源就OK啦。

具体操作步骤:

1、敲开终端

2、敲命令

~$ mkdir ~/.pip

~$ vim ~/.pip/pip.conf

按ENTER进入新的空白文件,当然这是建立在ubuntu装了vim编辑器的前提下

3、编辑文件内容

  [global]
  index-url = http://mirrors.aliyun.com/pypi/simple
  [install]
  trusted-host=mirrors.aliyun.com
 

这是将国内阿里云的镜像源设置为pip的默认下载源的意思,而且是全局的,一次操作,终生无忧

4、保存,退出

5、之后在终端使用pip install 各种包就可以达到速度M/s级的啦

补充:

国内不只有阿里云的源,还有其他的,

猜你喜欢

转载自www.cnblogs.com/cxhzy/p/11042669.html