Python UV - 安装、升级、卸载

Python UV - 安装、升级、卸载

文章目录


官方文档详见: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 helpfor this command -V, --version Display the uv version Use `uv help`formore details. 

Read more

C语言指针与数组的深度关联及实战应用

C语言指针与数组的深度关联及实战应用

C语言指针与数组的深度关联及实战应用 💡 学习目标:掌握指针与数组的内在联系,熟练运用指针操作数组元素,解决实际开发中的数组遍历、数据交换等问题;学习重点:数组名的本质、指针算术运算操作数组、指针数组与数组指针的区别及应用。 38.1 数组名与指针的关系 在C语言中,数组和指针有着密不可分的联系。很多初学者会混淆数组名和指针变量的概念,其实二者既有关联,又有本质区别。 38.1.1 数组名的本质 💡 数组名在大多数情况下会被编译器隐式转换为指向数组首元素的常量指针。 我们来看一段简单的代码: #include<stdio.h>intmain(){int arr[5]={10,20,30,40,50};printf("数组首元素地址:%p\n", arr);printf("数组首元素地址:%p\n&

基于VeRL框架的GSPO算法在Atlas 800T A2服务器上实践

作者:昇腾实战派 知识地图:强化学习知识地图 背景与意义 本篇文章主要基于VeRL框架上提出的GSPO算法在昇腾NPU上进行实践部署,并为大家简单介绍GRPO算法思想以及其和GSPO算法特性差异。 算法原理 论文地址 GRPO:https://arxiv.org/abs/2402.03300 GSPO:https://arxiv.org/abs/2507.18071 GRPO:群组相对策略优化 群组相对策略优化(GRPO)的核心创新在于消除了对计算密集型价值模型的依赖,该算法采用了一种创新的群组生成和相对评估机制:对于给定的输入提示,系统生成G个不同的响应构成一个群组,随后奖励模型对群组内所有响应进行评分。通过计算群组内分数的均值和标准差,算法为每个响应计算相对优势值 A ^ i \hat{A}_i A^i 。优于群组平均水平的响应获得正向优势,反之则获得负向优势。这种设计显著降低了强化学习训练的内存占用和计算复杂度,使大规模模型的训练变得更加高效和可行,但其底层实现存在一个关键的设计缺陷,该缺陷在大规模模型训练中会导致严重的稳定性问题。 问题的根源在于奖励分配与优化

Leetcode Hot 100 (C语言版) 1-21

博主搞嵌入式的,走底层纯C的,为了找实习/工作刷点题,平时AI coding习惯了,怕手撕代码写不出来,这里刷题顺便分享下思路,代码能跑就行,有什么问题欢迎指出,博主是新手入门; 这里按照难度排序依次进行。 在刷leetcode前建议可以先练一练牛客的算法入门,效果会更好。 1.两数之和 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target  的那 两个 整数,并返回它们的数组下标。 分析:经典劝退题,难度不高但是能看出来平时写不写代码;直接暴力双循环解决,也有用哈希表来做的,咱这能跑就行。 int* twoSum(int* nums, int numsSize, int target, int* returnSize) { int *a =(int*)malloc(sizeof(int)*2)

LeetCode 141题:环形链表的艺术与科学

LeetCode 141题:环形链表的艺术与科学

🌟 LeetCode 141题:环形链表的艺术与科学 * 🌀 环形链表:当数据开始循环舞蹈 * 🔍 解法一:哈希表法 - 记忆的艺术 * 解题思路 * 性能分析 * 🏃‍♂️ 解法二:快慢指针法 - 龟兔赛跑的智慧 * 解题思路 * 性能优势 * 💻 代码实现与调试心得 * 🌈 思维与实现的分离 * 🎯 总结 因为想更好地为义父义母大佬服务,本文 Bilibili 视频地址 🌀 环形链表:当数据开始循环舞蹈 在计算机科学的世界里,链表是一种优雅而基础的数据结构。正常链表如同一条笔直的小路,从起点(head)出发,每个节点指向下一个节点,最终以空指针(nullptr)作为终点,标志着旅程的结束。 Head Node1 Node2 Node3 nullptr 然而,环形链表则打破了这种线性规则,它更像是一个神秘的莫比乌斯环,没有真正的终点。链表的某个节点不再指向空,而是指向链表中已经存在的另一个节点,形成了一个无尽的循环。 Head