Skip to content

Windows 下 uv 换源方法错误 #196

Open
@xrgzs

Description

@xrgzs

你操作了什么?

chsrc set uv

发生了什么?

换源没有生效,写 uv.toml 配置文件的位置错误。

本应该怎么样?

根据 文档

uv will also discover user-level configuration at ~/.config/uv/uv.toml (or $XDG_CONFIG_HOME/uv/uv.toml) on macOS and Linux, or %APPDATA%\uv\uv.toml on Windows; and system-level configuration at /etc/uv/uv.toml (or $XDG_CONFIG_DIRS/uv/uv.toml) on macOS and Linux, or %SYSTEMDRIVE%\ProgramData\uv\uv.toml on Windows.

Windows 的路径应该为 %APPDATA%\uv\uv.toml,如:C:\Users\Xiaoran\AppData\Roaming\uv\uv.toml

存放到 ~/.config/uv/uv.toml 则不会读取,换源失败。

chsrc 版本

chsrc: Change Source (GPLv3+) v0.2.1-2025/04/13 by RubyMetric

你使用的是哪个操作系统?

Windows

OS 版本 / OS 发行版

Microsoft Windows [版本 10.0.19045.5608]

Log 输出

PS> chsrc set uv
[chsrc 测速] 测速中

  ^ 上游默认源 (https://pypi.org/simple) ... 0.00 Byte/s | HTTP码 000
  - 北京外国语大学开源软件镜像站 ... 52.22 MByte/s
  - 兰州大学开源社区镜像站 ... 34.67 MByte/s
  - 吉林大学开源镜像站 ... 41.20 MByte/s
  - 上海交通大学致远镜像站 ... 39.38 MByte/s
  - 清华大学开源软件镜像站 ... 42.01 MByte/s
  - 阿里巴巴开源镜像站(公网) ... 491.14 KByte/s
  - 南京大学开源镜像站 ... 20.32 MByte/s
  - 北京大学开源镜像站 ... 39.73 MByte/s
  - 腾讯软件源(公网) ... 99.86 KByte/s
  - 华为开源镜像站 ... 56.51 MByte/s
  - 华中科技大学开源镜像站 ... 39.05 MByte/s

最快镜像站: 华为开源镜像站
[chsrc 提示] 目录不存在,已自动创建 C:\Users\Xiaoran\.config\uv\
[chsrc 提示] 文件不存在,跳过备份: ~/.config/uv/uv.toml
[chsrc 运行] printf '[[index]]
url = "https://mirrors.huaweicloud.com/repository/pypi/simple"
default = true
' >> ~/.config/uv/uv.toml
'[[index]][chsrc 运行] ✓ 命令执行成功

--------------------------------
chsrc: 全自动换源完成, 感谢镜像提供方: 华为开源镜像站
PS> uv add requests
⠸ charset-normalizer==3.4.2 ...等半天都没反应

防止重复问题

  • 我已在项目的 GitHub 和 Gitee 两个仓库分别搜索过类似的 issue

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions