专业团队承接各类定制化软件系统

  • 源码跳动,年轻无畏,代码筑梦!
  • 专注定制化软件,领航海外 APP 开发,精雕出海网站,巧制小程序,匠心打造定制化系统。
  • 以创新为翼,用专业护航。
  • 突破国界限制,为全球客户定制专属数字世界,开启无限可能的科技新篇!
微信二维码

👆合作咨询和老板谈👆

[pip] 更新国内镜像源(0903 更新)

381次阅读
没有评论

共计 1549 个字符,预计需要花费 4 分钟才能阅读完成。

国内 pip 镜像源服务域名

Python官方 https://pypi.python.org/simple/
阿里云 https://mirrors.aliyun.com/pypi/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
中国科学技术大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣 http://pypi.douban.com/simple/
腾讯云 https://mirrors.cloud.tencent.com/pypi/simple/
华中理工大学 http://pypi.hustunique.com/
山东理工大学 http://pypi.sdutlinux.org/
pip 国内镜像源列表

pip

临时使用

以下均为清华镜像源为例,其他镜像服务器同理更换域名即可。

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

注意:

simple 不能少。
pip 要求使用 https ,因此需要 https 而不是 http

设为默认

升级 pip 到最新的版本后进行配置:

python -m pip install --upgrade pip
pip config set global.index-url 
https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple

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

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

配置多个镜像源

如果您想配置多个镜像源平衡负载,可在已经替换 index-url 的情况下通过以下方式继续增加源站:

pip config set global.extra-index-url "<url1> <url2>..."

请自行替换引号内的内容,源地址之间需要有空格

例如

pip config set global.extra-index-url "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"

PDM

通过如下命令设置默认镜像:

pdm config pypi.url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple

Poetry

通过以下命令为单个项目设置首选镜像:

poetry source add --priority=primary mirrors https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/

通过以下命令为单个项目设置补充镜像:

poetry source add --priority=supplemental mirrors https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/

Poetry 尚未支持全局设置镜像。

使用全局镜像的临时方案是将 Poetry 的安装器切换回 pip,如下所示。但该方式会在将来的版本中停止支持。

poetry config experimental.new-installer false

Homebrew

export HOMEBREW_PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
正文完
加入轩源的网络日志微信群参与讨论
post-qrcode
 0
轩源
版权声明:本站原创文章,由 轩源 于2024-09-03发表,共计1549字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
支持作者

☝️用微信请我喝杯咖啡☕️

😛如果文章对您有用,请支持作者😛

支持作者

☝️用支付宝请我喝杯奶茶🧋

专业团队承接各类定制化软件系统

  • 源码跳动,年轻无畏,代码筑梦!
  • 专注定制化软件,领航海外 APP 开发,精雕出海网站,巧制小程序,匠心打造定制化系统。
  • 以创新为翼,用专业护航。
  • 突破国界限制,为全球客户定制专属数字世界,开启无限可能的科技新篇!
微信二维码

👆合作咨询和老板谈👆

评论(没有评论)