python
install_error
ai_generated
true
错误:找不到命令 'git' - 你是否已安装 'git' 并将其加入 PATH?
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?
ID: python/pip-vcs-dependency-git-not-found
80%修复率
87%置信度
0证据数
2024-09-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
某个需求使用了 VCS URL(如 `git+https://...`),但构建环境中未安装 git 或 git 不在 PATH 中(常见于精简 Docker 镜像)。
English
A requirement uses a VCS URL (e.g., `git+https://...`) but git is not installed or not on PATH in the build environment (common in slim Docker images).
解决方案
-
95% 成功率
Install git in the image/container: apt-get update && apt-get install -y git pip install git+https://github.com/org/repo
-
85% 成功率
Pin to a released wheel instead of a VCS URL: pip install org-package==1.2.3
无效尝试
常见但无效的做法:
-
90% 失败
git is still required to clone; --no-deps does not bypass the VCS fetch.
-
90% 失败
Trusted-host affects TLS, not the missing git binary.