pip install pip -U # 升级pip到最新版本
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
#此方法配置后安装包时可能会提示下载源不可信,需要手动加上--trusted-host mirrors.aliyun.com
或者直接修改文件:
文件位置:
- ~/.config/pip/pip.conf
- ~/.pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com