Python uv 配置国内源
2025年7月3日用户级别配置文件:
文件路径:%APPDATA%\uv\uv.toml
在该文件中添加以下内容:
[[index]]
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
default = true
项目级别配置文件:
文件路径:项目目录下的pyproject.toml
或uv.toml
。
在pyproject.toml
中添加:
[[tool.uv.index]]
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
default = true
或在uv.toml
中添加:
[[index]]
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
default = true
备注
清华源出现问题时,可以考虑使用中科大源:
[[index]]
url = "https://mirrors.ustc.edu.cn/pypi/simple"
default = true