安装
pip install uv
检查
安装后可运行以下命令,查看是否安装成功:
uv --version
示例输出:
uv 0.6.3 (a0b9f22a2 2025-02-24)
升级
使用自更新命令重新运行安装程序(可能修改 shell 配置文件):
uv self update
要禁用此行为,设置 INSTALLER_NO_MODIFY_PATH=1。
或者使用 pip 升级:
pip install --upgrade uv
设置自动补全
Bash:
echo 'eval "$(uv generate-shell-completion bash)"' >> ~/.bashrc
Zsh:
echo 'eval "$(uv generate-shell-completion zsh)"' >> ~/.zshrc
卸载
执行以下两步:
- 清理存储数据(可选):
$ uv cache clean
$ rm -r "$(uv python dir)"
$ rm -r "$(uv tool dir)"
提示:在删除二进制文件之前,您可能想删除 uv 存储的任何数据。
- 删除 uv 和 uvx 二进制文件:
macOS 和 Linux:
$ rm ~/.local/bin/uv ~/.local/bin/uvx
Windows:
$ rm ~\.local\bin\uv.exe
$ rm ~\.local\bin\uvx.exe
注意:在 0.5.0 之前,uv 被安装到了 ~/.cargo/bin。可以从那里删除这些二进制文件。升级到旧版本将不会自动删除二进制文件 ~/.cargo/bin。
UV 命令
% uv An extremely fast Python package manager.
Usage: uv [OPTIONS]<COMMAND>
Commands:
run Run a or script
init Create a new project
add Add dependencies to the project
remove Remove dependencies from the project
Update the projects lockfile
Export the projects dependency tree
tool Run and install commands provided by Python packages
python Manage Python versions and installations
pip Manage Python packages with a pip-compatible interface
venv Create a virtual environment
build Build Python packages into distributions and wheels
publish Upload distributions to an index
cache Manage uvs version
Display documentation a
Cache options:
-n, --no-cache Avoid reading from or writing to the cache, instead using a temporary directory the duration of the operation [: UV_NO_CACHE=]
--cache-dir <CACHE_DIR> Path to the cache directory [: UV_CACHE_DIR=]
Python options:
--python-preference <PYTHON_PREFERENCE> Whether to prefer uv-managed or system Python installations [: UV_PYTHON_PREFERENCE=][possible values: only-managed, managed, system, only-system]
--no-python-downloads Disable automatic downloads of Python. [: ]
Global options:
-q, --quiet Do not any output
-v, --verbose... Use verbose output
--color<COLOR_CHOICE> Control the use of color output [possible values: auto, always, never]
--native-tls Whether to load TLS certificates from the platforms version
Use `uv `formore details.


