1. Why do you need pip to change the source download
When installing third-party libraries, many libraries come from abroad, and the download speed is touchingly slow!
2. Common domestic sources
https://pypi.tuna.tsinghua.edu.cn/simple #清华
http://mirrors.aliyun.com/pypi/simple/ #阿里云
https://pypi.mirrors.ustc.edu.cn/simple/ #中国科技大学
http://pypi.hustunique.com/ #华中理工大学
http://pypi.sdutlinux.org/ #山东理工大学
http://pypi.douban.com/simple/ #豆瓣
3. Source replacement method
If it is only used temporarily, you can temporarily change the source .
pip install -i 源地址(清华,阿里,豆瓣) 推荐使用使用清华源和阿里源
If it is a personal PC, it is recommended to change the source permanently .
##### Windows
-1 首先按下windows+e键,然后在文件地址栏输入:%APPDATA% 回车,快速进入 C:\Users\电脑用户\AppData\Roaming 文件夹中
-2 新建 pip 文件夹并
-3 在文件夹中新建 pip.ini 配置文件
-4 配置文件写入:
如果想换源就直接把源的路径换了就可以了
'''
[global]
index-url = https://mirrors.aliyun.com/pypi/simple
[install]
use-mirrors =true
mirrors =https://mirrors.aliyun.com/pypi/simple
trusted-host =mirrors.aliyun.com
'''
# 以后再命令行中,下载模块,就会走国内源了
pip3.8 install django==3.2.12
If you want to add more sources, you can configure the following information in pip.ini.
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
extra-index-url =
https://mirrors.aliyun.com/pypi/simple/
https://mirror.baidu.com/pypi/simple