python

关注公众号 jb51net

关闭
首页 > 脚本专栏 > python > Python PiP 换镜像源

Python PiP 换镜像源的实现步骤

作者:Rbtkai

这篇文章主要为大家介绍了配置pip镜像源以加速Python包下载,包括更新pip、永久/临时换源、验证源生效、恢复默认源等操作,具有一定的参考价值,感兴趣的可以了解一下

1、更新PiP

python -m pip install --upgrade pip

2、永久换源(阿里)

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

3、临时换源(阿里)

pip install markdown -i https://mirrors.aliyun.com/pypi/simple/

4、验证源是否生效

pip config list

5、恢复默认源

删除配置文件或运行:

pip config unset global.index-url

6、国内常用镜像源

镜像源名称镜像源 URL
阿里云https://mirrors.aliyun.com/pypi/simple/
华为云https://repo.huaweicloud.com/repository/pypi/simple/
腾讯云https://mirrors.cloud.tencent.com/pypi/simple/
腾讯云https://mirrors.cloud.tencent.com/pypi/simple/
清华大学https://pypi.tuna.tsinghua.edu.cn/simple/
中国科技大学https://pypi.mirrors.ustc.edu.cn/simple/
华中科技大学https://pypi.hustunique.com/
豆瓣(用于Python包)http://pypi.douban.com/simple/

7、指定镜像源下载库

在安装或更新Python包时,可以使用-i或–index-url选项指定镜像源。例如,使用pip安装requests包时,可以指定清华大学的镜像源:

pip install requests -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple

到此这篇关于基于web管理OpenVPN服务的安装使用详解的文章就介绍到这了,更多相关web管理OpenVPN服务安装内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家! 

您可能感兴趣的文章:
阅读全文