# Managing Python Projects With uv: An All-in-One Solution

- 发布方：Real Python；作者：Leodanis Pozo Ramos
- 形式：文章 · en
- 原始资源：[https://realpython.com/python-uv/](<https://realpython.com/python-uv/>)
- 本站页面：[https://oplearnx.com/resources/res\_m4entq73smgd](<https://oplearnx.com/resources/res_m4entq73smgd>)
- 学习主题：计算机科学 / 编程与软件工程 / Python；计算机科学 / 编程与软件工程
- 内容状态：状态待核验
- 原始发布时间：2026-10-26 22:00
- 本站首次收录：2026-10-27 00:19

## 能学到什么

学会把 uv 当作集成式 Python 包与项目管理器使用：理解它整合的多项功能，安装并升级 uv，创建项目，用它做依赖安装、虚拟环境与版本管理，并了解它可以构建与发布包。

- 说明 uv 整合了 pip、pip-tools、pipx、poetry、pyenv、twine、virtualenv 等工具的哪些功能
- 在 Windows 或 Linux/macOS 上用独立安装器安装 uv，并了解从 PyPI 用 pipx 或 pip 安装的替代方式
- 用 uv 初始化一个包含 Git 仓库、虚拟环境、pyproject.toml 和 README 的 Python 项目
- 运行项目入口脚本，并理解 uv 如何自动创建和管理虚拟环境
- 添加、升级、删除依赖与开发依赖，并用锁定机制复现环境
- 了解 uv 可以构建分发包并发布到 PyPI 这类包仓库

## 适合我吗

- 适合：适合有一定 Python 基础、想用单一工具替代 pip/poetry/pyenv 等来管理项目依赖与打包发布的学习者。
- 需要留意：不适合完全零 Python 基础、或想学习数据分析与算法建模而非工程工具链的读者。

## 前置条件与费用

- 知识前置：需要基本了解 Python 虚拟环境的使用、pyproject.toml 项目文件的设置，以及为项目构建可分发包；网页标注难度为 intermediate。
- 软件、账号与硬件：需要一台可安装软件的电脑和命令行终端（Windows PowerShell 或 Linux/macOS Shell）。
- 内容费用：免费：节选中可直接读到教程正文与全部章节目录，未出现阅读拦截；导航中的“Unlock All Content”是站点会员入口。
- 实践费用：实践无额外费用：uv 为本机免费安装的命令行工具，练习不涉及付费云服务或 GPU；网页未对费用作说明。
- 转载与修改：按材料分别核对，见本页“来源核验与开课实跑”；仓库许可不自动适用于教材或视频。

## 准备工具

- [uv](<https://docs.astral.sh/uv/>)：Python 包与项目管理的命令行工具
- 终端（PowerShell / Shell）：执行安装与 uv 命令

## 学习指南

开课检查：提示词由本站整理，尚未按提示词实际完成开课检查。

### 开课提示词（Windows）

```text
请帮我把「Managing Python Projects With uv: An All-in-One Solution」的学习环境一次准备好，让我之后只需要按顺序学习和做练习。
开始前先问我：课程放在哪个目录（等我给出完整路径），确认我的操作系统和已有工具。确认前不要创建文件或安装软件。

课程入口：https://realpython.com/python-uv/
我的系统：Windows。如果实际不符，先调整方案。
本次路线：Windows：本机动手。只准备这条路线需要的工具；只读路线不安装运行环境、不配置模型密钥。
练习：在本机按教程步骤创建一个示例项目，添加与删除依赖，锁定并同步环境。
课节（官方顺序）：
1. Managing Python Projects With uv: An All-in-One Solution（主页）：https://realpython.com/python-uv/
2. Getting to Know uv for Python：https://realpython.com/python-uv/
3. Installing uv to Manage Python Projects：https://realpython.com/python-uv/
4. Using the Standalone Installer：https://realpython.com/python-uv/
5. Installing From PyPI：https://realpython.com/python-uv/
6. Upgrading to the Latest uv Version：https://realpython.com/python-uv/
7. Handling Python Projects With uv：https://realpython.com/python-uv/
8. Creating a Python Project：https://realpython.com/python-uv/
9. Running the Project's Entry-Point Script：https://realpython.com/python-uv/
10. Using uv for Dependency Management：https://realpython.com/python-uv/
11. Adding and Installing Dependencies：https://realpython.com/python-uv/
12. Upgrading and Removing Dependencies：https://realpython.com/python-uv/
13. Managing Development Dependencies：https://realpython.com/python-uv/
14. Locking and Syncing the Environment：https://realpython.com/python-uv/
15. Building and Publishing Packages：https://realpython.com/python-uv/
16. Configuring the Project：https://realpython.com/python-uv/
17. Building a Distribution：https://realpython.com/python-uv/
18. Publishing a Distribution：https://realpython.com/python-uv/
19. Conclusion：https://realpython.com/python-uv/
20. Frequently Asked Questions：https://realpython.com/python-uv/

1. 环境
- 本机终端（Windows PowerShell 或 Linux/macOS Shell）
- uv 命令行工具
- 安装前先列出要装的软件和命令，等我同意；已装好的直接复用。
2. 材料
- 官方课程页面：只记录链接 https://realpython.com/python-uv/
3. 目录（最外层放在我确认的位置）
realpython-python-uv/
├── README.md        # 课程入口、课节清单、每次怎么开始
├── progress.md      # 每课：读讲义 / 做练习 / 记笔记
├── questions.md     # 待解决的问题
├── check-env.ps1     # 环境自检，按 README 操作
├── data/            # 练习用到的样例数据
└── lessons/         # 每课一个文件夹：notes.md + exercises/
    ├── 01-01-managing-python-projects-with-uv/
    ├── 02-02-getting-to-know-uv-for/
    ├── 03-03-installing-uv-to-manage-python/
    ├── 04-04-using-the-standalone-installer/
    ├── 05-05-installing-from-pypi/
    ├── 06-06-upgrading-to-the-latest-uv/
    ├── 07-07-handling-python-projects-with-uv/
    ├── 08-08-creating-a-python-project/
    ├── 09-09-running-the-project-s-entry/
    ├── 10-10-using-uv-for-dependency-management/
    ├── 11-11-adding-and-installing-dependencies/
    ├── 12-12-upgrading-and-removing-dependencies/
    ├── 13-13-managing-development-dependencies/
    ├── 14-14-locking-and-syncing-the-environment/
    ├── 15-15-building-and-publishing-packages/
    ├── 16-16-configuring-the-project/
    ├── 17-17-building-a-distribution/
    ├── 18-18-publishing-a-distribution/
    ├── 19-19-conclusion/
    └── 20-20-frequently-asked-questions/
- 每课文件夹里建 notes.md（顶部写本课官方链接）和 exercises/；课节文件夹名称与上面一致。
- 已有课程目录先检查并复用；不覆盖笔记、作业或 progress.md，不重置已有进度。尚未发布的课节保留入口并注明未发布，不能代写讲义或虚构练习。
4. 自检
- 创建 check-env.ps1，逐项检查并记录“通过/未通过”：
- 在课程根目录运行；每项检查独立执行，进入子目录不能影响下一项。将下面检查转换为 PowerShell 命令，不使用 Bash 语法。
  - uv --version  → 输出版本号，确认 uv 已安装
  - uv run python -c "print('ok')"  → 在项目目录内输出 ok，说明项目环境可用
  - 打开项目目录确认存在 pyproject.toml 和 uv.lock  → 两个文件均存在
- 标注为人工检查、浏览器操作或 notebook 单元的项目，按相应方式操作，不直接粘贴进 shell；脚本只包含当前系统可执行的命令。
- 仅在当前路线需要、对应材料已获准保存、工具已安装时运行该项；需要登录、付费或尚未开放的材料记为“需要我操作/未验证”，不能伪报通过。不执行会调用付费 API、提交作业或修改云服务的检查。
- 运行一次，把结果给我看；未通过的项目说明原因和修复办法。
5. 学习计划
- README.md：课程入口、课节清单（带链接）、每次学习怎么开始（使用“每课提示词”）。
- progress.md：每课三项勾选——读讲义、做练习、记笔记。
6. 最后分三部分汇报：已完成、需要我自己操作的、尚未验证的。

边界：
- 需要管理员权限、会产生费用或需要填写密钥的操作，先告诉我原因，等我同意。密钥由我在本机配置，不发到聊天，不写进笔记或版本库；原项目需要 .env 时确认已被 Git 忽略。
- 不替我写练习或作业答案，也不替我提交。我卡住时只给提示；我明确要求时才给解答。
- 只下载许可允许个人保存的材料；其余只放链接。不把未运行的命令说成成功。
如果你不能直接操作我的文件系统，请在确认目录后给出适用于我的系统、可直接执行的命令和需要保存的文件内容。
```

### 开课提示词（macOS）

```text
请帮我把「Managing Python Projects With uv: An All-in-One Solution」的学习环境一次准备好，让我之后只需要按顺序学习和做练习。
开始前先问我：课程放在哪个目录（等我给出完整路径），确认我的操作系统和已有工具。确认前不要创建文件或安装软件。

课程入口：https://realpython.com/python-uv/
我的系统：macOS。如果实际不符，先调整方案。
本次路线：macOS：本机动手。只准备这条路线需要的工具；只读路线不安装运行环境、不配置模型密钥。
练习：在本机按教程步骤创建一个示例项目，添加与删除依赖，锁定并同步环境。
课节（官方顺序）：
1. Managing Python Projects With uv: An All-in-One Solution（主页）：https://realpython.com/python-uv/
2. Getting to Know uv for Python：https://realpython.com/python-uv/
3. Installing uv to Manage Python Projects：https://realpython.com/python-uv/
4. Using the Standalone Installer：https://realpython.com/python-uv/
5. Installing From PyPI：https://realpython.com/python-uv/
6. Upgrading to the Latest uv Version：https://realpython.com/python-uv/
7. Handling Python Projects With uv：https://realpython.com/python-uv/
8. Creating a Python Project：https://realpython.com/python-uv/
9. Running the Project's Entry-Point Script：https://realpython.com/python-uv/
10. Using uv for Dependency Management：https://realpython.com/python-uv/
11. Adding and Installing Dependencies：https://realpython.com/python-uv/
12. Upgrading and Removing Dependencies：https://realpython.com/python-uv/
13. Managing Development Dependencies：https://realpython.com/python-uv/
14. Locking and Syncing the Environment：https://realpython.com/python-uv/
15. Building and Publishing Packages：https://realpython.com/python-uv/
16. Configuring the Project：https://realpython.com/python-uv/
17. Building a Distribution：https://realpython.com/python-uv/
18. Publishing a Distribution：https://realpython.com/python-uv/
19. Conclusion：https://realpython.com/python-uv/
20. Frequently Asked Questions：https://realpython.com/python-uv/

1. 环境
- 本机终端（Windows PowerShell 或 Linux/macOS Shell）
- uv 命令行工具
- 安装前先列出要装的软件和命令，等我同意；已装好的直接复用。
2. 材料
- 官方课程页面：只记录链接 https://realpython.com/python-uv/
3. 目录（最外层放在我确认的位置）
realpython-python-uv/
├── README.md        # 课程入口、课节清单、每次怎么开始
├── progress.md      # 每课：读讲义 / 做练习 / 记笔记
├── questions.md     # 待解决的问题
├── check-env.sh     # 环境自检，按 README 操作
├── data/            # 练习用到的样例数据
└── lessons/         # 每课一个文件夹：notes.md + exercises/
    ├── 01-01-managing-python-projects-with-uv/
    ├── 02-02-getting-to-know-uv-for/
    ├── 03-03-installing-uv-to-manage-python/
    ├── 04-04-using-the-standalone-installer/
    ├── 05-05-installing-from-pypi/
    ├── 06-06-upgrading-to-the-latest-uv/
    ├── 07-07-handling-python-projects-with-uv/
    ├── 08-08-creating-a-python-project/
    ├── 09-09-running-the-project-s-entry/
    ├── 10-10-using-uv-for-dependency-management/
    ├── 11-11-adding-and-installing-dependencies/
    ├── 12-12-upgrading-and-removing-dependencies/
    ├── 13-13-managing-development-dependencies/
    ├── 14-14-locking-and-syncing-the-environment/
    ├── 15-15-building-and-publishing-packages/
    ├── 16-16-configuring-the-project/
    ├── 17-17-building-a-distribution/
    ├── 18-18-publishing-a-distribution/
    ├── 19-19-conclusion/
    └── 20-20-frequently-asked-questions/
- 每课文件夹里建 notes.md（顶部写本课官方链接）和 exercises/；课节文件夹名称与上面一致。
- 已有课程目录先检查并复用；不覆盖笔记、作业或 progress.md，不重置已有进度。尚未发布的课节保留入口并注明未发布，不能代写讲义或虚构练习。
4. 自检
- 创建 check-env.sh，逐项检查并记录“通过/未通过”：
- 在课程根目录运行；每项检查独立执行，进入子目录不能影响下一项。使用当前系统的终端运行。
  - uv --version  → 输出版本号，确认 uv 已安装
  - uv run python -c "print('ok')"  → 在项目目录内输出 ok，说明项目环境可用
  - 打开项目目录确认存在 pyproject.toml 和 uv.lock  → 两个文件均存在
- 标注为人工检查、浏览器操作或 notebook 单元的项目，按相应方式操作，不直接粘贴进 shell；脚本只包含当前系统可执行的命令。
- 仅在当前路线需要、对应材料已获准保存、工具已安装时运行该项；需要登录、付费或尚未开放的材料记为“需要我操作/未验证”，不能伪报通过。不执行会调用付费 API、提交作业或修改云服务的检查。
- 运行一次，把结果给我看；未通过的项目说明原因和修复办法。
5. 学习计划
- README.md：课程入口、课节清单（带链接）、每次学习怎么开始（使用“每课提示词”）。
- progress.md：每课三项勾选——读讲义、做练习、记笔记。
6. 最后分三部分汇报：已完成、需要我自己操作的、尚未验证的。

边界：
- 需要管理员权限、会产生费用或需要填写密钥的操作，先告诉我原因，等我同意。密钥由我在本机配置，不发到聊天，不写进笔记或版本库；原项目需要 .env 时确认已被 Git 忽略。
- 不替我写练习或作业答案，也不替我提交。我卡住时只给提示；我明确要求时才给解答。
- 只下载许可允许个人保存的材料；其余只放链接。不把未运行的命令说成成功。
如果你不能直接操作我的文件系统，请在确认目录后给出适用于我的系统、可直接执行的命令和需要保存的文件内容。
```

### 开课提示词（Linux）

```text
请帮我把「Managing Python Projects With uv: An All-in-One Solution」的学习环境一次准备好，让我之后只需要按顺序学习和做练习。
开始前先问我：课程放在哪个目录（等我给出完整路径），确认我的操作系统和已有工具。确认前不要创建文件或安装软件。

课程入口：https://realpython.com/python-uv/
我的系统：Linux。如果实际不符，先调整方案。
本次路线：Linux：本机动手。只准备这条路线需要的工具；只读路线不安装运行环境、不配置模型密钥。
练习：在本机按教程步骤创建一个示例项目，添加与删除依赖，锁定并同步环境。
课节（官方顺序）：
1. Managing Python Projects With uv: An All-in-One Solution（主页）：https://realpython.com/python-uv/
2. Getting to Know uv for Python：https://realpython.com/python-uv/
3. Installing uv to Manage Python Projects：https://realpython.com/python-uv/
4. Using the Standalone Installer：https://realpython.com/python-uv/
5. Installing From PyPI：https://realpython.com/python-uv/
6. Upgrading to the Latest uv Version：https://realpython.com/python-uv/
7. Handling Python Projects With uv：https://realpython.com/python-uv/
8. Creating a Python Project：https://realpython.com/python-uv/
9. Running the Project's Entry-Point Script：https://realpython.com/python-uv/
10. Using uv for Dependency Management：https://realpython.com/python-uv/
11. Adding and Installing Dependencies：https://realpython.com/python-uv/
12. Upgrading and Removing Dependencies：https://realpython.com/python-uv/
13. Managing Development Dependencies：https://realpython.com/python-uv/
14. Locking and Syncing the Environment：https://realpython.com/python-uv/
15. Building and Publishing Packages：https://realpython.com/python-uv/
16. Configuring the Project：https://realpython.com/python-uv/
17. Building a Distribution：https://realpython.com/python-uv/
18. Publishing a Distribution：https://realpython.com/python-uv/
19. Conclusion：https://realpython.com/python-uv/
20. Frequently Asked Questions：https://realpython.com/python-uv/

1. 环境
- 本机终端（Windows PowerShell 或 Linux/macOS Shell）
- uv 命令行工具
- 安装前先列出要装的软件和命令，等我同意；已装好的直接复用。
2. 材料
- 官方课程页面：只记录链接 https://realpython.com/python-uv/
3. 目录（最外层放在我确认的位置）
realpython-python-uv/
├── README.md        # 课程入口、课节清单、每次怎么开始
├── progress.md      # 每课：读讲义 / 做练习 / 记笔记
├── questions.md     # 待解决的问题
├── check-env.sh     # 环境自检，按 README 操作
├── data/            # 练习用到的样例数据
└── lessons/         # 每课一个文件夹：notes.md + exercises/
    ├── 01-01-managing-python-projects-with-uv/
    ├── 02-02-getting-to-know-uv-for/
    ├── 03-03-installing-uv-to-manage-python/
    ├── 04-04-using-the-standalone-installer/
    ├── 05-05-installing-from-pypi/
    ├── 06-06-upgrading-to-the-latest-uv/
    ├── 07-07-handling-python-projects-with-uv/
    ├── 08-08-creating-a-python-project/
    ├── 09-09-running-the-project-s-entry/
    ├── 10-10-using-uv-for-dependency-management/
    ├── 11-11-adding-and-installing-dependencies/
    ├── 12-12-upgrading-and-removing-dependencies/
    ├── 13-13-managing-development-dependencies/
    ├── 14-14-locking-and-syncing-the-environment/
    ├── 15-15-building-and-publishing-packages/
    ├── 16-16-configuring-the-project/
    ├── 17-17-building-a-distribution/
    ├── 18-18-publishing-a-distribution/
    ├── 19-19-conclusion/
    └── 20-20-frequently-asked-questions/
- 每课文件夹里建 notes.md（顶部写本课官方链接）和 exercises/；课节文件夹名称与上面一致。
- 已有课程目录先检查并复用；不覆盖笔记、作业或 progress.md，不重置已有进度。尚未发布的课节保留入口并注明未发布，不能代写讲义或虚构练习。
4. 自检
- 创建 check-env.sh，逐项检查并记录“通过/未通过”：
- 在课程根目录运行；每项检查独立执行，进入子目录不能影响下一项。使用当前系统的终端运行。
  - uv --version  → 输出版本号，确认 uv 已安装
  - uv run python -c "print('ok')"  → 在项目目录内输出 ok，说明项目环境可用
  - 打开项目目录确认存在 pyproject.toml 和 uv.lock  → 两个文件均存在
- 标注为人工检查、浏览器操作或 notebook 单元的项目，按相应方式操作，不直接粘贴进 shell；脚本只包含当前系统可执行的命令。
- 仅在当前路线需要、对应材料已获准保存、工具已安装时运行该项；需要登录、付费或尚未开放的材料记为“需要我操作/未验证”，不能伪报通过。不执行会调用付费 API、提交作业或修改云服务的检查。
- 运行一次，把结果给我看；未通过的项目说明原因和修复办法。
5. 学习计划
- README.md：课程入口、课节清单（带链接）、每次学习怎么开始（使用“每课提示词”）。
- progress.md：每课三项勾选——读讲义、做练习、记笔记。
6. 最后分三部分汇报：已完成、需要我自己操作的、尚未验证的。

边界：
- 需要管理员权限、会产生费用或需要填写密钥的操作，先告诉我原因，等我同意。密钥由我在本机配置，不发到聊天，不写进笔记或版本库；原项目需要 .env 时确认已被 Git 忽略。
- 不替我写练习或作业答案，也不替我提交。我卡住时只给提示；我明确要求时才给解答。
- 只下载许可允许个人保存的材料；其余只放链接。不把未运行的命令说成成功。
如果你不能直接操作我的文件系统，请在确认目录后给出适用于我的系统、可直接执行的命令和需要保存的文件内容。
```

### 每课提示词

```text
继续学习「Managing Python Projects With uv: An All-in-One Solution」。课程目录是 realpython-python-uv/（不知道完整路径就先问我）。
1. 读 progress.md，找到下一课；如果我指定了第几课，就准备那一课。
2. 打开这一课的官方页面和本地讲义，列出本课练习要用的工具、文件和样例数据。缺少的先告诉我，等我同意再安装或下载。
3. 在 lessons/ 对应的课节文件夹里准备好练习：exercises/ 里给每道题建一个文件，写上题号和题目原文链接，不写答案；已有文件保留，样例数据放到 data/。拿不到官方题目或起始代码时记录限制，不编造替代品。
4. 按 README 运行开课时生成的自检脚本或在线检查清单，并检查本课新增工具能否正常使用。
5. 告诉我：本课先读哪几节、从哪道练习开始、大约需要多久。我学完后，帮我在 progress.md 勾选并把问题整理到 questions.md。

边界：
- 需要管理员权限、会产生费用或需要填写密钥的操作，先告诉我原因，等我同意。密钥由我在本机配置，不发到聊天，不写进笔记或版本库；原项目需要 .env 时确认已被 Git 忽略。
- 不替我写练习或作业答案，也不替我提交。我卡住时只给提示；我明确要求时才给解答。
- 只下载许可允许个人保存的材料；其余只放链接。不把未运行的命令说成成功。
```

### 课节（官方顺序）

1. [Managing Python Projects With uv: An All-in-One Solution（主页）](<https://realpython.com/python-uv/>)
2. [Getting to Know uv for Python](<https://realpython.com/python-uv/>)
3. [Installing uv to Manage Python Projects](<https://realpython.com/python-uv/>)
4. [Using the Standalone Installer](<https://realpython.com/python-uv/>)
5. [Installing From PyPI](<https://realpython.com/python-uv/>)
6. [Upgrading to the Latest uv Version](<https://realpython.com/python-uv/>)
7. [Handling Python Projects With uv](<https://realpython.com/python-uv/>)
8. [Creating a Python Project](<https://realpython.com/python-uv/>)
9. [Running the Project's Entry-Point Script](<https://realpython.com/python-uv/>)
10. [Using uv for Dependency Management](<https://realpython.com/python-uv/>)
11. [Adding and Installing Dependencies](<https://realpython.com/python-uv/>)
12. [Upgrading and Removing Dependencies](<https://realpython.com/python-uv/>)
13. [Managing Development Dependencies](<https://realpython.com/python-uv/>)
14. [Locking and Syncing the Environment](<https://realpython.com/python-uv/>)
15. [Building and Publishing Packages](<https://realpython.com/python-uv/>)
16. [Configuring the Project](<https://realpython.com/python-uv/>)
17. [Building a Distribution](<https://realpython.com/python-uv/>)
18. [Publishing a Distribution](<https://realpython.com/python-uv/>)
19. [Conclusion](<https://realpython.com/python-uv/>)
20. [Frequently Asked Questions](<https://realpython.com/python-uv/>)

## 指南参考

- [课程主页](<https://realpython.com/python-uv/>)

## 来源、许可与验证记录

- **开课提示词未完整验证，需要自备账号或资源**：uv 命令行工具，需按教程安装
- **内容提示**：原站推广：页面导航含“Unlock All Content and Become a Python Expert”会员入口，正文侧栏与文末有“Recommended Course: Python Project Management With uv”付费课程推荐。
- 转载与修改 · 课程页面与材料：未找到明确许可。网页未写明内容许可，仅提供免费示例代码下载与测验 [依据](<https://realpython.com/python-uv/>)
- 链接检查：1/1 个可以访问

## 来源与推荐

- 编辑整理收录

---
来源：LearnMap · 学径（https://oplearnx.com）
