小于 1 分钟
Install UV
使用pipx下载
pipx install uv
Install python
If use pyenv, set the UV_PYTHON_INSTALL_DIR
to pyenv versions folder \versions
uv python install 3.10
创建新项目
uv init xxx
克隆项目后构建uv开发环境
1. 安装所需Python版本
使用uv
安装指定版本的Python(假设项目要求Python 3.11.9):
uv python install 3.11.9
2. 进入项目目录
3. 为项目绑定Python版本
uv python pin 3.11.9
4. 同步项目依赖
uv sync
5. 激活虚拟环境
source .venv/bin/activate
6. 验证环境
python --version
uv run main.py
发布程序
uv publish --token=