Ubuntu系统配置系列3——一学就会pip换镜像源

编程

前面提到了换系统的软件源,Python安装第三方库时,也是遇到网速受限问题,这里需要换pip源,镜像站供选择的有很多,这里就简单介绍一下:

1阿里云 http://mirrors.aliyun.com/pypi/simple/ 

2豆瓣 http://pypi.douban.com/simple/

3 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

#1.创建pip的配置文件,这里依然用vim编辑为例,也可用nano、gedit

sudo vim ~/pip/pip.conf

# 2.修改内容如下,这里以替换阿里pypi为例

[global]

index-url = http://mirrors.aliyun.com/pypi/simple/

注:以阿里云为例(见上),如果有镜像站Python的第三方库不存在,可以选择用临时的镜像站下载,操作如下

#这里以Python3的库管理pip3,安装豆瓣镜像站的scipy库为例:pip install scipy -i 源地址(见上)

sudo pip3 install scipy -i http://pypi.douban.com/simple/

 

以上是 Ubuntu系统配置系列3——一学就会pip换镜像源 的全部内容, 来源链接: utcz.com/z/514736.html

回到顶部