@@ -9,19 +9,19 @@ tags = ['Python']
99
1010## Features
1111
12- ### Python versions
12+ #### Python versions
1313- ` uv python install ` : 安装 Python 版本
1414- ` uv python list ` : 查看可用的 Python 版本
1515- ` uv python find ` : 查找安装的 Python 版本
1616- ` uv python pin ` : 固定当前项目的 Python 版本
1717- ` uv python uninstall ` : 卸载一个 Python 版本
1818
19- ### Scripts
19+ #### Scripts
2020- ` uv run ` : 运行一个脚本
2121- ` uv add --script ` : 为脚本添加一个依赖
2222- ` uv remove --script ` : 移除一个依赖
2323
24- ### Projects
24+ #### Projects
2525使用 ` pyproject.toml ` 配置项目
2626- ` uv init ` : 创建一个 Python 项目
2727- ` uv add ` : 为项目添加依赖
@@ -33,15 +33,15 @@ tags = ['Python']
3333- ` uv build ` : 将项目构建为分发归档文件
3434- ` uv publish ` : 将项目发布到包索引
3535
36- ### Tools
36+ #### Tools
3737允许与安装工具
3838- ` uvx / uv tool run ` : 在临时环境运行一个工具
3939- ` uv tool install ` : 安装一个工具
4040- ` uv tool uninstall ` : 卸载一个工具
4141- ` uv tool list ` : 列出已安装工具
4242- ` uv tool update-shell ` : 更新 shell 以包含工具执行
4343
44- ### The pip interface
44+ #### The pip interface
4545手动管理环境与包, 用于旧的工作流, 或一些高级命令功能
4646- ` uv venv ` : 创建虚拟环境
4747
@@ -58,7 +58,7 @@ tags = ['Python']
5858- ` uv pip compile ` : 将依赖编译到一个锁文件中
5959- ` uv pip sync ` : 使用锁文件同步环境
6060
61- ### Utility
61+ #### Utility
6262管理与检查 uv 的状态, 例如缓存、存储目录或子升级
6363- ` uv cache clean ` : 清除缓存条目
6464- ` uv cache prune ` : 移除过期的缓存条目
@@ -80,7 +80,7 @@ name = "example"
8080version = " 0.1.0"
8181```
8282额外的项目元数据和配置包含:
83- - [ Python versino requirement] ( https://docs.astral.sh/uv/concepts/projects/config/#python-version-requirement )
83+ - [ Python version requirement] ( https://docs.astral.sh/uv/concepts/projects/config/#python-version-requirement )
8484- [ Dependencies] ( https://docs.astral.sh/uv/concepts/projects/dependencies/ )
8585- [ Build system] ( https://docs.astral.sh/uv/concepts/projects/config/#build-systems )
8686- [ Entry points] ( https://docs.astral.sh/uv/concepts/projects/config/#entry-points )
@@ -89,7 +89,7 @@ version = "0.1.0"
8989使用 uv 处理项目时, uv 会根据需要创建虚拟环境.
9090虽然某些 uv 命令会创建临时环境 (` uv run --isolated ` ), 但 uv 也会在 ` pyproject.toml ` 旁边的 ` .venv ` 目录中管理一个持久环境, 其中包含项目及其依赖项.
9191它存储在项目内部是为了方便编辑器查找, 编辑器需要环境来提供代码补全和类型提示.
92- 不建议将 ` .venv ` 目录包含在版本控制中, 它会通过内部 ` .gitignore ` 文件自动从 git 中排除
92+ 不建议将 ` .venv ` 目录包含在版本控制中, 它会通过内部 ` .gitignore ` 文件自动从 git 中排除.
9393
9494要在项目环境中运行命令, 应该使用 ` uv run ` .
9595或者, 项目环境可以像普通虚拟环境一样正常激活.
0 commit comments