pip 默认使用的源在国外(https://pypi.python.org/simple/),有时在 pip install 时下载会比较慢,为了解决这一问题,只需作以下简单配置。html
建立目录及 pip.conf 配置文件:python
[root@localhost ~]# mkdir -p $HOME/.config/pip/ [root@localhost ~]# cd !$ [root@localhost pip]# vim pip.conf
添加以下内容:vim
[global] timeout = 60 find-links = http://pypi.douban.com/simple/ trusted-host = pypi.douban.com
保存退出便可切换到豆瓣的源,以后再使用 pip install 就没必要担忧由于源在国外而形成的下载缓慢问题了。bash
完。ide
参考文档:ui
https://pip.pypa.io/en/latest/user_guide.html#configurationspa