# Rye简介 * 官网/文档:[https://rye.astral.sh/](https://rye.astral.sh/) * GitHub:[https://github.com/astral-sh/rye](https://github.com/astral-sh/rye) ## 简介 * Rye = Python 项目管理工具 + 虚拟环境管理器 + 构建发布工具,核心理念类似于:poetry + pyenv + pip-tools + build + twine 全部整合进一个统一工具中 ## 安装 ```shell curl -sSf https://rye.astral.sh/get | bash ``` ## 使用 常用命令: ``` rye init # 初始化一个新项目(生成 pyproject.toml) rye add requests # 添加依赖 rye remove numpy # 移除依赖 rye sync # 安装所有依赖(自动创建虚拟环境) rye run python # 在虚拟环境中运行命令 rye build # 构建项目(生成 wheel) rye publish # 发布到 PyPI ``` ## 对比 | 功能/工具 | Rye | Poetry | Pip + venv | Conda | | --------- | ------------------- | ---------------- | ------------------ | ----------------- | | 虚拟环境管理 | ✅ | ✅ | ✅ | ✅ | | 项目初始化 | ✅ | ✅ | ❌ | ❌ | | 构建 wheel | ✅ | ✅ | ❌ | ❌ | | 发布 PyPI | ✅ | ✅ | ❌ | ❌ | | Python 下载 | ✅(自动下载) | ❌ | ❌ | ✅ | | 配置文件 | 统一 `pyproject.toml` | `pyproject.toml` | `requirements.txt` | `environment.yml` |