跳到主要内容
极客日志极客日志面向AI+效率的开发者社区
首页博客我的书AI学习GitHub 精选镜像AI工具UI配色美学关于
搜索内容 / 工具 / 仓库 / 镜像...⌘K搜索
注册
博客列表
Python

Python uv 安装、升级与卸载

Python 包管理器 uv 的安装、版本检查、升级、自动补全设置及卸载方法。支持通过 pip 安装或使用自更新命令,提供 macOS/Linux 和 Windows 下的卸载步骤,并列出常用命令选项。

橘子海发布于 2026/3/28更新于 2026/10/26122 浏览
Python uv 安装、升级与卸载

安装

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

卸载

执行以下两步:

  1. 清理存储数据(可选):
$ uv cache clean
$ rm -r "$(uv python dir)"
$ rm -r "$(uv tool dir)"

提示:在删除二进制文件之前,您可能想删除 uv 存储的任何数据。

  1. 删除 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 command or script
  init     Create a new project
  add      Add dependencies to the project
  remove   Remove dependencies from the project
  sync     Update the project's environment
  lock     Update the project's lockfile
  export   Export the project's lockfile to an alternate format
  tree     Display the project's 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 source distributions and wheels
  publish  Upload distributions to an index
  cache    Manage uv's cache
  self     Manage the uv executable
  version  Display uv's version
  help     Display documentation for a command
Cache options:
  -n, --no-cache Avoid reading from or writing to the cache, instead using a temporary directory for the duration of the operation [env: UV_NO_CACHE=]
  --cache-dir <CACHE_DIR> Path to the cache directory [env: UV_CACHE_DIR=]
Python options:
  --python-preference <PYTHON_PREFERENCE> Whether to prefer uv-managed or system Python installations [env: UV_PYTHON_PREFERENCE=][possible values: only-managed, managed, system, only-system]
  --no-python-downloads Disable automatic downloads of Python. [env: "UV_PYTHON_DOWNLOADS=never"]
Global options:
  -q, --quiet Do not print any output
  -v, --verbose... Use verbose output
  --color<COLOR_CHOICE> Control the use of color in output [possible values: auto, always, never]
  --native-tls Whether to load TLS certificates from the platform's native certificate store [env: UV_NATIVE_TLS=]
  --offline Disable network access [env: UV_OFFLINE=]
  --allow-insecure-host <ALLOW_INSECURE_HOST> Allow insecure connections to a host[env: UV_INSECURE_HOST=]
  --no-progress Hide all progress outputs [env: UV_NO_PROGRESS=]
  --directory<DIRECTORY> Change to the given directory prior to running the command
  --project<PROJECT> Run the command within the given project directory
  --config-file <CONFIG_FILE> The path to a `uv.toml`file to use for configuration [env: UV_CONFIG_FILE=]
  --no-config Avoid discovering configuration files (`pyproject.toml`, `uv.toml`)[env: UV_NO_CONFIG=]
  -h, --help Display the concise helpfor this command
  -V, --version Display uv's version
Use `uv help`formore details.

目录

  1. 安装
  2. 检查
  3. 升级
  4. 设置自动补全
  5. 卸载
  6. UV 命令

更多推荐文章

查看全部
  • 常见机器学习模型评估指标与方法汇总
  • FPGA 设计实战:CAN 总线原理与 Verilog 实现
  • Python 核心基础语法
  • AI 产品经理核心能力模型与转型路径
  • 使用星辰 RPA 搭建小红书自动发文机器人
  • Strapi 快速部署实战:3 分钟为前端项目配置 API 后台
  • Tauri 架构解析:从 WebView 到工具链与生态
  • 基于 Java 与高德地图的县域烟花销售点 GIS 盘点实践
  • 初学者如何选择编程语言和开发方向指南
  • iOS 新系统适配:TabBar 液态玻璃效果与 WiFi SSID 获取方案
  • Linux 服务器通用安全加固指南 - 基本系统安全
  • Jetson Orin NX 16G 配置 AI 服务自动启动:Ollama、llama-server 与 OpenClaw Gateway
  • VMware 17 Ubuntu 虚拟机与宿主机复制粘贴失效修复
  • Java 集成 modbus4j 3.0.3 实现 PLC 数据采集与连接管理
  • 无线联邦学习:隐私保护下的 AI 协同训练
  • Linux 普通用户安装 Claude Code 全流程指南
  • Java 基础算法实战:字符转 ASCII 与四舍五入
  • 工业具身智能落地:从识别到执行的实操思路
  • 七款主流大模型英文降重能力实测与对比
  • C++ STL string 容器常见遍历方式

相关免费在线工具

  • curl 转代码

    解析常见 curl 参数并生成 fetch、axios、PHP curl 或 Python requests 示例代码。 在线工具,curl 转代码在线工具,online

  • Base64 字符串编码/解码

    将字符串编码和解码为其 Base64 格式表示形式即可。 在线工具,Base64 字符串编码/解码在线工具,online

  • Base64 文件转换器

    将字符串、文件或图像转换为其 Base64 表示形式。 在线工具,Base64 文件转换器在线工具,online

  • Markdown转HTML

    将 Markdown(GFM)转为 HTML 片段,浏览器内 marked 解析;与 HTML转Markdown 互为补充。 在线工具,Markdown转HTML在线工具,online

  • HTML转Markdown

    将 HTML 片段转为 GitHub Flavored Markdown,支持标题、列表、链接、代码块与表格等;浏览器内处理,可链接预填。 在线工具,HTML转Markdown在线工具,online

  • JSON 压缩

    通过删除不必要的空白来缩小和压缩JSON。 在线工具,JSON 压缩在线工具,online