You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

pip安装.whl提示不支持平台,调用pip.pep425tags遇属性错误求助

Why pip.pep425tags Throws AttributeError in pip 10.0.1 (Python 3.6)

The Root Cause

Starting with pip 10.0.0, the internal pep425tags module was removed from pip's public API. That code was part of pip's internal logic for handling platform compatibility tags, but it was never designed to be used directly by end users. So when you tried calling pip.pep425tags.get_supported() in your REPL, pip rightfully throws an AttributeError because that module no longer exists in pip 10+.

How to Check Supported Platform Tags Instead

Don’t worry—there are two straightforward ways to get the same information without relying on deprecated internal modules:

1. Use pip's Built-in Debug Command (Recommended)

Open your terminal/command prompt and run this command:

pip debug --verbose

Scroll through the output until you find the section labeled Supported tags—this will list all the platform, Python version, and ABI tags that your pip installation supports. It’s the official, supported way to get this info in pip 10 and later.

2. Use the packaging Library (If You Prefer Code)

If you want to fetch the tags via Python code instead of a terminal command, you can use the packaging library (a dependency pip itself uses under the hood):

  • First install it if you haven’t already:
    pip install packaging
    
  • Then run this code in your REPL or script:
    from packaging.tags import sys_tags
    # Get a list of all supported tags
    supported_tags = list(sys_tags())
    for tag in supported_tags:
        print(tag)
    

This will output the same compatibility tags you were looking for.

Quick Note on Your Original Wheel Installation Issue

Once you have the list of supported tags, make sure the .whl file you’re trying to install matches at least one of those tags. Common mismatches include:

  • Using a wheel built for a different Python version (e.g., a py37 wheel with Python 3.6)
  • Using a wheel built for a different OS/architecture (e.g., a Linux wheel on Windows, a 32-bit wheel on a 64-bit system)

内容的提问来源于stack exchange,提问作者Alina

火山引擎 最新活动