咨询pip download中--platform、--abi、--implementation的有效值及查询途径
Hey there! Let's dive into the valid values for the --platform, --abi, and --implementation parameters in pip download, plus how to get the full list of each.
--platform
This parameter targets a specific operating system and architecture for your package download. Valid values adhere to the PEP 425 platform identifier standard, with common examples including:
manylinux_2_17_x86_64(64-bit Linux compatible with most modern distributions)win_amd64(64-bit Windows)macosx_11_0_arm64(Apple Silicon macOS 11.0 and newer)linux_aarch64(64-bit ARM-based Linux)win32(32-bit Windows)
--abi
The ABI (Application Binary Interface) parameter specifies the binary compatibility layer for your Python runtime. Valid values depend on your Python implementation and version:
- For CPython (the standard, most widely used Python implementation), common values include:
cp310m(CPython 3.10 with GIL on Unix-like systems)cp310(CPython 3.10 on Windows)abi3(ABI compatible with multiple CPython versions, often used for extension modules)
- For PyPy, values follow a format like
pp38-pypy38_pp73(PyPy 3.8 compatible)
--implementation
This parameter restricts downloads to packages built for a specific Python runtime. Valid values are shorthand codes for major implementations:
cp: CPython (the official, default Python implementation)pp: PyPy (a JIT-compiled, high-performance implementation)jy: Jython (Python running on the Java Virtual Machine)ip: IronPython (Python running on .NET)pypy: Alternate shorthand for PyPy (sometimes seen in package identifiers)
If you need a full, up-to-date set of valid values that work with your pip version, these are the most reliable methods:
1. Run pip debug --verbose
This is the go-to tool. Execute this command in your terminal, and it will output all supported PEP 425 identifiers for your system—including a clear breakdown of valid platform, abi, and implementation values. It’s tailored to your pip installation, so you know the values are fully compatible.
2. Check pip’s built-in help
Run pip download --help for a quick reference. While it won’t list every possible value, it links to the PEP 425 standard and explains the core structure of each parameter, which helps you understand how valid values are formatted.
3. Review the PEP 425 Specification
PEP 425 lays out the official rules for these identifiers. It doesn’t list every single valid value (since there are endless combinations of OS versions and architectures), but it defines the format rules—so you can derive valid values for niche platforms or versions if needed.
内容的提问来源于stack exchange,提问作者ericg

