# 错误：找不到命令 'git' - 你是否已安装 'git' 并将其加入 PATH？

- **ID:** `python/pip-vcs-dependency-git-not-found`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

某个需求使用了 VCS URL（如 `git+https://...`），但构建环境中未安装 git 或 git 不在 PATH 中（常见于精简 Docker 镜像）。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Install git in the image/container:
apt-get update && apt-get install -y git
pip install git+https://github.com/org/repo
   ```
2. **** (85% 成功率)
   ```
   Pin to a released wheel instead of a VCS URL:
pip install org-package==1.2.3
   ```

## 无效尝试

- **** — git is still required to clone; --no-deps does not bypass the VCS fetch. (90% 失败率)
- **** — Trusted-host affects TLS, not the missing git binary. (90% 失败率)
