error
pip
build_error
ai_generated
true
错误:legacy-install-failure × 尝试安装包时遇到错误。 ╰─> numpy 注意:这是上述包的问题,不是 pip 的问题。
error: legacy-install-failure × Encountered error while trying to install package. ╰─> numpy note: This is an issue with the package mentioned above, not pip.
ID: pip/legacy-install-failure-numpy
88%修复率
84%置信度
1证据数
2023-09-18首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| pip 21.0 | active | — | — | — |
| pip 23.0 | active | — | — | — |
| pip 24.0 | active | — | — | — |
根因分析
包(例如 numpy)需要旧版构建系统(setup.py),但由于缺少构建依赖项或编译器问题而失败,通常是因为该包未提供针对该平台的预编译 wheel。
English
The package (e.g., numpy) requires a legacy build system (setup.py) that fails due to missing build dependencies or compiler issues, often because the package does not provide pre-built wheels for the platform.
官方文档
https://pip.pypa.io/en/stable/topics/legacy-builds/解决方案
-
如果可用,安装预编译 wheel:`pip install numpy --only-binary :all:` 或使用 `pip install numpy==1.24.3`(该版本为大多数平台提供 wheel)。
-
安装系统构建依赖:在 Ubuntu 上运行 `sudo apt-get install python3-dev build-essential`;在 macOS 上运行 `xcode-select --install`。
-
使用 conda 作为替代方案:`conda install numpy` 提供预编译的二进制文件。
无效尝试
常见但无效的做法:
-
Reinstall pip and retry, assuming pip itself is broken.
90% 失败
The error is from the package's build system, not pip's installation.
-
Use `pip install --no-build-isolation numpy` without fixing the underlying build tools.
70% 失败
This may expose more errors but doesn't fix missing compilers or libraries.
-
Install numpy from a different index without verifying the version.
80% 失败
The same build failure will occur if no pre-built wheel exists.