Windows下uv环境硬链接失败问题

warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.

If the cache and target directories are on different filesystems, hardlinking may not be supported.

If this is intentional, set `export UV_LINK_MODE=copy` or use `--link-mode=copy` to suppress this warning.

原因:uv 的缓存目录与你的目标安装目录(虚拟环境)不在同一个文件系统 / 磁盘分区(比如缓存在 C 盘,项目 / 虚拟环境在 E 盘),而操作系统不允许跨文件系统创建硬链接(hardlink),所以 uv 只能退而求其次用「完整文件复制」,并弹出性能警告。

1.清除之前的缓存

一般缓存会存在C盘目录下,如下,会占据大量空间

也可命令行查看

uv.exe cache dir

相关命令

clean Clear the cache, removing all entries or those linked to specific packages

prune Prune all unreachable objects from the cache

dir Show the cache directory

size Show the cache size

使用命令删除缓存

uv cache clean

2.修改 uv 缓存目录到 其它盘

  • 打开「系统属性→高级→环境变量」
  • 新建用户变量:变量名 UV_CACHE_DIR,变量值 E:\.uv\cache(或其他 E 盘路径)
  • 重启终端后生效

硬链接问题解决

相关推荐
蚰蜒螟5 小时前
深入 Linux 内核同步机制:从 futex 到 spinlock 的完整旅程
linux·windows·microsoft
dllmayday6 小时前
Linux 上用终端连接 WiFi
linux·服务器·windows
Curtain_Gin12 小时前
windows nvim lazy
windows
生而为虫14 小时前
Claude Code 最新版安装教程(Windows/Mac/Linux 全平台) 面向普通用户的 Claude Code 安装与模型接入指南
linux·windows·macos
DevilSeagull14 小时前
Windows 批处理 (Batch) 编程: 从入门到入土. (一) 基础概念与环境配置
开发语言·windows·后端·batch·语言
CyL_Cly15 小时前
Parsec(parsec安卓/windows/macos下载)
windows
2601_9583205717 小时前
【小白零基础上手 】钉钉内部机器人接入 OpenClaw 完整流程讲解(含安装包)
人工智能·windows·机器人·钉钉·open claw·open claw安装
love530love17 小时前
f2 项目(多平台的作品下载与接口数据处理)源码部署记录
人工智能·windows·f2
生而为虫17 小时前
在VScode中使用Claude Code agent并配置模型(仅mac电脑实际操作,windows电脑未实际操作如有问题可留言)
windows·vscode·macos
叶小鸡18 小时前
Java 篇-项目实战-天机学堂(从0到1)-day10
windows·microsoft