pip是一个通用的python包管理工具,提供对python包的查找,下载,安装与卸载的功能。
国内的pip镜像
国外的pip镜像网络不稳定,导致pip安装python包特别的慢。国内的pip镜像主要包括:
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
临时修改pip镜像源
可以在使用pip时,后面加上-i参数,临时指定pip镜像源。比如:
pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install BeautifulSoup -i http://mirrors.zte.com.cn/pypi/simple --trusted-host mirrors.zte.com.cn
永久修改pip镜像源
一般修改pip的配置文件pip.conf。
对于linux系统,配置文件一般存在于:/etc/pip.conf、/.pip/pip.conf、/.config/pip/pip.conf
配置文件的内容如下: