错误:找不到满足 <package> 要求的版本(来自版本:无)。未找到匹配的发行版(此平台没有可用的二进制文件)
ERROR: Could not find a version that satisfies the requirement <package> (from versions: none). No matching distribution found (no binary available for this platform)
ID: pip/no-binary-available-for-platform
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| pip 22.0+ | active | — | — | — |
| Python 3.11 | active | — | — | — |
| aarch64 | active | — | — | — |
根因分析
请求的包没有针对用户平台(例如 aarch64、32 位或不支持的操作系统)的预构建 wheel,并且由于缺少构建依赖项或平台不兼容,pip 无法从源代码构建。
English
The requested package has no pre-built wheel for the user's platform (e.g., aarch64, 32-bit, or unsupported OS), and pip cannot build from source due to missing build dependencies or platform incompatibility.
官方文档
https://pip.pypa.io/en/stable/topics/platform-compatibility/解决方案
-
通过安装构建依赖项允许 pip 从源代码构建:pip install <package> --no-binary :all:
-
使用为你的平台提供 wheel 的第三方仓库(例如 conda-forge 用于 aarch64):conda install -c conda-forge <package>
-
在兼容的机器上交叉编译 wheel 并传输:pip wheel <package> --wheel-dir=./wheels/ && pip install --no-index --find-links=./wheels/ <package>
无效尝试
常见但无效的做法:
-
Using --only-binary=:all: flag
100% 失败
This flag forces pip to only use binary wheels, but if none exist for the platform, it will fail immediately with the same error.
-
Installing with --no-index and pointing to a local directory with wrong wheels
90% 失败
Providing wheels built for a different architecture (e.g., x86_64 on arm64) will cause incompatible binary errors or segfaults at runtime.
-
Downgrading pip to an older version
20% 失败
Older pip versions have the same or worse platform detection; the issue is with the package availability, not pip version.