153 字
1 分钟
UV:Rust编写的Python神器安装配置与使用技巧

An extremely fast Python package and project manager, written in Rust.

Resources#

Install#

Terminal window
curl -LsSf https://astral.sh/uv/install.sh | sh

Update#

Terminal window
uv self update

国内加速#

Terminal window
export UV_DEFAULT_INDEX=https://pypi.tuna.tsinghua.edu.cn/simple

Install Python#

Terminal window
uv python install 3.13

Usage#

Terminal window
# Create a new Python project in the current directory:
uv init
# Create a new Python project in a directory with the given name:
uv init project_name
# Create a environment
uv venv -p 3.13
# Add a new package to the project:
uv add package
# Remove a package from the project:
uv remove package
# Add a new dev package to the project:
uv add --dev package
# Run a script in the project's environment:
uv run path/to/script.py
# Run a command in the project's environment:
uv run command
# Update a project's environment from pyproject.toml:
uv sync
# Create a lock file for the project's dependencies:
uv lock
# Export the project's dependencies to a requirements.txt file:
uv pip freeze > requirements.txt
UV:Rust编写的Python神器安装配置与使用技巧
https://lordhamster.com/posts/uv/
作者
LordHamster
发布于
2026-01-23
许可协议
CC BY-NC-SA 4.0
评论