Python UV安装、升级、卸载详细步骤记录

 更新时间:2025年06月14日 08:32:20   作者:云客Coder  
这篇文章主要介绍了Python UV安装、升级、卸载的详细步骤,uv是 Astral推出的下一代 Python 包与项目管理器,主打单一可执行文件、极致性能,文中通过代码介绍的非常详细,需要的朋友可以参考下

官方文档详见:https://docs.astral.sh/uv/getting-started/installation/

安装

pip install uv

检查

安装后可运行下面命令,查看是否安装成功

uv --version 
% uv --version
uv 0.6.3 (a0b9f22a2 2025-02-24)

升级

uv self update

将重新运行安装程序 并可能修改您的shell配置文件。

要禁用此行为,设置INSTALLER_NO_MODIFY_PATH=1

或:

pip install --upgrade uv

设置自动补全

echo 'eval "$(uv generate-shell-completion bash)"' >> ~/.bashrc
echo 'eval "$(uv generate-shell-completion zsh)"' >> ~/.zshrc

卸载

执行以下两步:

1、清理存储数据(可选):

$ uv cache clean
$ rm -r "$(uv python dir)"
$ rm -r "$(uv tool dir)"

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

2、删除 uv 和 uvx 二进制文件:

macOS 和 Linux

$ rm ~/.local/bin/uv ~/.local/bin/uvx

Windows

$ rm $HOME.local\bin\uv.exe
$ rm $HOME.local\bin\uvx.exe

注意:在0.5.0之前,uv被安装到了~/.cargo/bin。可以从那里删除这些二进制文件。
uninstall. 升级到旧版本将不会自动删除二进制文件 ~/.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 help for this command
  -V, --version
          Display the uv version

Use `uv help` for more details.

总结 

到此这篇关于Python UV安装、升级、卸载详细步骤的文章就介绍到这了,更多相关Python UV安装升级卸载内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • 使用Python处理CSV和Excel文件的操作方法

    使用Python处理CSV和Excel文件的操作方法

    在数据分析、自动化和日常开发中,CSV和Excel文件是非常常见的数据存储格式,ython提供了强大的工具来读取、编辑和保存这两种文件,满足从基本读取到复杂分析的需求,本文将深入介绍CSV和Excel文件的多种处理方法,帮助你更好地管理和分析数据,需要的朋友可以参考下
    2025-01-01
  • python实现视频抽帧与添加背景音频和字幕朗读的脚本分享

    python实现视频抽帧与添加背景音频和字幕朗读的脚本分享

    这篇文章主要为大家详细介绍了如何使用python实现视频抽帧、添加srt字幕朗读、添加背景音频等功能,感兴趣的小伙伴可以跟随小编一起学习一下
    2023-11-11
  • 在Python程序中操作文件之isatty()方法的使用教程

    在Python程序中操作文件之isatty()方法的使用教程

    这篇文章主要介绍了在Python程序中操作文件之isatty()方法的使用教程,是Python入门学习中的基础知识,需要的朋友可以参考下
    2015-05-05
  • 浅谈Tensorflow加载Vgg预训练模型的几个注意事项

    浅谈Tensorflow加载Vgg预训练模型的几个注意事项

    这篇文章主要介绍了浅谈Tensorflow加载Vgg预训练模型的几个注意事项说明,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2020-05-05
  • 一文详解Python Pandas中67个最常用的数据处理函数

    一文详解Python Pandas中67个最常用的数据处理函数

    Pandas 是 Python 中最强大的数据处理库之一,无论是数据分析、清洗还是可视化,都离不开它,本文整理了 67 个最常用的 Pandas 函数,建议收藏,随时查阅
    2025-12-12
  • python Web开发你要理解的WSGI & uwsgi详解

    python Web开发你要理解的WSGI & uwsgi详解

    这篇文章主要给大家介绍了关于python Web开发你一定要理解的WSGI & uwsgi的相关资料,文中通过示例代码介绍的非常详细,需要的朋友可以参考借鉴,下面随着小编来一起学习学习吧
    2018-08-08
  • python数据解析BeautifulSoup爬取三国演义章节示例

    python数据解析BeautifulSoup爬取三国演义章节示例

    这篇文章主要介绍了python数据解析BeautifulSoup爬取三国演义章节示例,文中附含详细示例代码,有需要的朋友可以借鉴参考下,希望能够有所帮助
    2021-09-09
  • Python基础中所出现的异常报错总结

    Python基础中所出现的异常报错总结

    本篇文章介绍了Python基础中所出现的异常报错总结,这是Python日常所常见的错误,现在总结出来给大家。
    2016-11-11
  • Python爬虫之爬取我爱我家二手房数据

    Python爬虫之爬取我爱我家二手房数据

    我爱我家的数据相对来说抓取难度不大,基本无反爬措施. 但若按照规则构造页面链接进行抓取,会出现部分页面无法获取到数据的情况.在网上看了几个博客,基本上都是较为简单的获取数据,未解决这个问题,在实际应用中会出错,本文有非常详细的代码示例,需要的朋友可以参考下
    2021-05-05
  • 详解Python 合并字典

    详解Python 合并字典

    这篇文章主要为大家介绍了Python的合并字典,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能够给你带来帮助
    2021-12-12

最新评论