pip源的常用国内镜像以及更换方法
https://pypi.tuna.tsinghua.edu.cn/simple/ # 清华大学
https://mirrors.aliyun.com/pypi/simple/ # 阿里云
https://pypi.douban.com/simple/ # 豆瓣
https://pypi.mirrors.ustc.edu.cn/simple/ # 中国科学技术大学
1. 临时使用国内镜像
pip install -i https://pypi.douban.com/simple/ django==2.2
2. 永久使用国内镜像
官方说明: https://pip.pypa.io/en/stable/user_guide/#config-file
pip源可以在pip.conf文件中设置,如果该文件不存在,则新建即可。
[global]
index-url = https://pypi.douban.com/simple
[install]
trusted-host = https://pypi.douban.com
而不同操作系统下pip.conf文件的存放位置不同:
Linux/Unix | ~/.pip/pip.conf | |
macOS | $HOME/Library/Application Support/pip/pip.conf | 亲测有效哈 |
Win7 | C:\ProgramData\PyPA\pip\pip.conf | 未测试 |