# 运行命令
uv run python main.py
# 传统方式 (pip + venv)
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# 耗时: 30-120 秒
# uv 方式
uv sync
# 耗时: 2-10 秒
# 运行命令
uv run python main.py
# 等价于但更简洁:
# source .venv/bin/activate && python main.py
更换为阿里源:
# 配置文件位置: ~/.config/uv/uv.toml
mkdir -p ~/.config/uv
cat > ~/.config/uv/uv.toml << EOF
[[index]]
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
default = true
EOF
单次使用:
# 单次使用
uv sync --index-url https://pypi.tuna.tsinghua.edu.cn/simple
# 或者
uv pip install package_name --index-url https://pypi.tuna.tsinghua.edu.cn/simple
欢迎来撩 : 汇总all
