使用 uv 时,为某些依赖指定特定的 index url

首先定义 index url

[[tool.uv.index]] name = "tsinghua" url = "https://pypi.tuna.tsinghua.edu.cn/simple" default = true

[[tool.uv.index]] name = "pytorch-cpu" url = "https://download.pytorch.org/whl/cpu"

然后指定哪个依赖使用特定的 index,如下:

[tool.uv.sources] torch = [ { index = "pytorch-cpu" }, ] torchaudio = [ { index = "pytorch-cpu" }, ] torchvision = [ { index = "pytorch-cpu" }, ]

参考文档

  1. Dive Into [tool.uv.index] 为 uv 配置 Python 镜像源。| 排除pypi | explicit和default参数,以及None参数

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注