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

硬链接问题解决

相关推荐
海天鹰7 小时前
WIN10修改窗口标题栏失去焦点背景色
windows
梦帮科技9 小时前
GRAVIS v5.5:向硬核桌面端进化与云端多节点容灾部署实践
windows·架构·rust·自动化·区块链·智能合约·数字货币
tianyazhichiC10 小时前
【VLC player 下载地址】
windows
小呀小叮当~11 小时前
OpenAI Codex 桌面版(Windows / macOS)体验分享:AI 编程效率再次提升
人工智能·windows·macos
Starry-sky(jing)12 小时前
Win11 装 ESP32 Arduino 库卡 3 小时?我把官方 3.3.10 全平台 522MB 搬到了蓝奏云,解压即用
运维·windows·esp32·arduino·离线安装
程序员老油条1 天前
WSL2 + Docker Desktop:Windows 下的完美 Java 开发环境
java·windows·docker·wsl2
binbin_521 天前
Flutter 开发鸿蒙实战:Windows 环境下从 HAP 构建到四 Tab 页面运行
windows·flutter·harmonyos
ylscode1 天前
微软推送KB5095189:Windows 11 OOBE开箱即用体验迎来新一轮优化
windows·microsoft
Fer_David1 天前
解决Windows无法在微软商店安装CodeX问题
windows
忧虑的小蚂蚁1 天前
dll文件32位64位检测工具以及Windows文件夹SysWow64的坑
windows