最简单的方法使用 -i
参数:
pip install *** -i http://pypi.douban.com/simple/
也可以使用自己搭的本地 PyPi
源(私源):
pip install *** -i http://pypi.<your domain name>.com/simple/
私源的搭建教程参考我之前写过的文章:
这种方法是临时的,如果想要永久更改源就需要将源写到配置文件中。
打开文件:
vi ~/.pip/pip.conf
写入源配置:
[global]
index-url = https://pypi.<your domain name>.com/simple/
[install]
trusted-host=mirrors.aliyun.com
国内常用镜像源:
名称 | 地址 |
---|---|
豆瓣 | http://pypi.douban.com/simple/ |
阿里云 | http://mirrors.aliyun.com/pypi/simple/ |
清华大学 | https://pypi.tuna.tsinghua.edu.cn/simple/ |