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

硬链接问题解决

相关推荐
86Eric1 天前
基于 Rclone 实现 Linux 数据库备份自动同步至 Windows 本地
linux·windows·rclone 自动同步
小小ken1 天前
windows远程桌面连接报错:发生身份验证错误。要求的函数不受支持,这可能是因为在远程计算机上阻止 NTLM 身份验证。
windows·远程桌面·windows server
Magic--1 天前
C++ STL中vector与list的核心区别
c++·windows·list
2301_旺仔1 天前
【prometheus】监控linux/windows
linux·windows·prometheus
Yiyi_Coding1 天前
在Windows系统安装Docker
windows·docker·容器
全球通史1 天前
Windows + WSL2 + RTX 2080 Ti 搭建 RDK X5 OpenExplorer GPU 量化环境实战
windows
韭菜钟1 天前
WIndows下一键切换网卡IP脚本
windows·网络协议·tcp/ip
Dontla1 天前
go语言Windows安装教程(安装go安装Golang安装)(GOPATH、Go Modules)
开发语言·windows·golang
liliangcsdn2 天前
mstsc不在“C:\Windows\System32“下在C:\windows\WinSxS\anmd64xxx“问题分析
开发语言·windows
低频电磁之道2 天前
解决 Windows C++ DLL 导出类不可见的编译错误
c++·windows