Python3 pip国内加速(windows和linux)

阿里云源:https://mirrors.aliyun.com/pypi/simple
腾讯云源:https://mirrors.cloud.tencent.com/pypi/simple
豆瓣源:https://pypi.doubanio.com/simple
清华源:https://pypi.tuna.tsinghua.edu.cn/simple
华为源:https://repo.huaweicloud.com/simple

替换对应地址
index-url = 
trusted-host = 
华为加速地址
临时使用:
pip install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple 安装的包名
或者
pip install -i https://repo.huaweicloud.com/simple/sqlalchemy
永久使用:
# Window
完整地址:C:\Users\%UserName%\pip\pip.ini
Ctrl + R 进入运行,地址栏输入:C:\Users\%UserName%,然后创建pip文件夹,然后创建pip.ini文件
内容:
[global]
index-url = https://repo.huaweicloud.com/repository/pypi/simple
trusted-host = repo.huaweicloud.com
timeout = 120
————————————————————————
# Linux
mkdir -p ~/.pip/
cat <<EOF >  ~/.pip/pip.conf
[global]
index-url = https://repo.huaweicloud.com/repository/pypi/simple
trusted-host = repo.huaweicloud.com
timeout = 120
EOF
posted @ 2021-10-10 22:05  运维之爪  阅读(413)  评论(0编辑  收藏  举报