两种方式,择一即可
1. 临时添加url
指定源url
pip install numpy -i http://pypi.douban.com/simple/
2. 永久性修改pip源
编辑 ~/.pip/pip.conf 文件,若不存在自行创建即可
# vim ~/.pip/pip.conf
内容如下:
[global]
timeout = 15
index-url = http://mirrors.aliyun.com/pypi/simple/
extra-index-url= http://pypi.douban.com/simple/
[install]
trusted-host=
mirrors.aliyun.com
pypi.douban.com