astral-sh/uv

A way to remove old Python versions

开放

#15,805 创建于 2025年9月12日

 (3 条评论) (11 个反应) (0 位负责人)Rust (3,111 个派生)batch import
enhancementhelp wanted

仓库指标

星标
 (84,934 个星标)
PR 合并指标
 (平均合并 7天 16小时) (30 天内合并 259 个 PR)

描述

Summary

After using uv to install all active Python versions and keep them updated for a while, I found my ~/.local/share/uv/python directory consuming 3GB. This includes many versions I won't use again, like the alpha and beta versions of 3.14.

I couldn't find an easy way to remove all but the latest version of each Python (including freethreading variants), so I found it easier to blast them all away with uv python uninstall --all and then re-running my automated install process (using Ansible).

This clearout saved me ~2.3GB of disk space.

This is a bit unintuitive and wastes time and bandwidth. It would be nicer if there were a way to prune down the installed Python versions to just the latest of each release, or something like that.

Example

$ uv python uninstall --outdated
Searching for Python installations
Uninstalled 7 outdated Python versions in 14.45s:
 - cpython-3.9.20-macos-aarch64-none
 - cpython-3.9.21-macos-aarch64-none
 - cpython-3.9.22-macos-aarch64-none
...

贡献者指南