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 盘路径)
  • 重启终端后生效

硬链接问题解决

相关推荐
淡海水4 小时前
01-07-运行时-GC深度剖析-内存分配回收与结构选择
jvm·windows·unity·gc
DAVIED96 小时前
llama.cpp 本地部署完全指南
windows·llama·wsl·llamacpp
云上飞476369628 小时前
Windows WSL2 + Docker 环境下NVIDIA PhysicsNeMo 安装指南
windows·docker·physicsai·physicsnemo
weixin_6688 小时前
取消Windows 11 默认精简的鼠标右键文件夹菜单
windows·计算机外设
love530love8 小时前
彻底清理 Windows 右键“打开方式“中的重复/失效程序项(PyCharm 多版本残留实战 + 自动化脚本)
运维·人工智能·windows·pycharm·jetbrains·toolbox
王维同学20 小时前
进程模块枚举、映像身份与线程启动地址关联
c++·windows·安全
x²+(y-√³x²)²=11 天前
Linux打包文件到Windows,文件/文件类型丢失
linux·运维·windows
Rudon滨海渔村1 天前
windows10如何删除多余的输入法 - 仅保留English+拼音
windows·输入法
YCOSA20251 天前
雨晨 Windows 11 IoT 企业版 LTSC 26H1 特制 28000.2796
windows·物联网
Jay-r1 天前
DeepSeek Harness 极简上手:装好、玩熟、让它自己长新能力
人工智能·windows·ai·github·ai编程·deepseek·harness