astral-sh/uv

A way to remove old Python versions

Open

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

在 GitHub 查看
 (3 评论) (7 反应) (0 负责人)Rust (84,934 star) (3,111 fork)batch import
enhancementhelp wanted

描述

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
...

贡献者指南