当前位置: 代码网 > it编程>前端脚本>Python > Python UV安装、升级、卸载详细步骤记录

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

2025年06月15日 Python 我要评论
官方文档详见:https://docs.astral.sh/uv/getting-started/installation/安装pip install uv检查安装后可运行下面命令,查看是否安装成功u

官方文档详见: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安装升级卸载内容请搜索代码网以前的文章或继续浏览下面的相关文章希望大家以后多多支持代码网!

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com