首页 / 未分类 / Python设置第三方PyPI镜像源

Python设置第三方PyPI镜像源

摘要:PyPI 镜像使用帮助 PyPI 镜像在每次同步成功后间隔 5 分钟同步一次。 临时使用 pip install -i https://pypi.mirrors.ustc.edu.cn/simple some-package 注意,simp...

PyPI 镜像使用帮助

PyPI 镜像在每次同步成功后间隔 5 分钟同步一次。

临时使用

pip install -i https://pypi.mirrors.ustc.edu.cn/simple some-package

注意,simple 不能少, 是 https 而不是 http

设为默认

pip 版本低于10.0.0升级后再进行配置:

python -m pip install --upgrade pip

设置永久默认:

pip config set global.index-url "https://pypi.mirrors.ustc.edu.cn/simple"
pip config set global.extra-index-url "https://pypi.mirrors.ustc.edu.cn/simple"
pip config set global.trusted-host "pypi.mirrors.ustc.edu.cn"

如果您到 pip 默认源的网络连接较差,临时使用第三方镜像站来升级 pip:

python -m pip install -i https://pypi.mirrors.ustc.edu.cn/simple --upgrade pip

推荐第三方镜像源:
https://pypi.mirrors.ustc.edu.cn/simple (中国科学技术大学镜像源)
https://pypi.douban.com/simple (豆瓣镜像源)
https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple (清华大学 TUNA 镜像源)
https://pypi.org/simple (PyPI 官方源)

版权声明:《Python设置第三方PyPI镜像源》为作者阿凡原创文章,转载请注明原文地址。
最后编辑:2024-7-12
分享到:
发表评论