python config_error ai_generated true

错误:用户请求package==1.0,但extra index URL上提供了package==2.0

ERROR: The user requested package==1.0 but package==2.0 is available on the extra index URL

ID: python/pip-extra-index-url-conflict

其他格式: JSON · Markdown 中文 · English
80%修复率
87%置信度
0证据数
2025-06-10首次发现

版本兼容性

版本状态引入弃用备注
3.11 active

根因分析

使用多个索引时,pip可能在额外索引上找到不同版本,与指定版本冲突。

English

When using multiple indexes, pip may find a different version on an extra index and conflict with the specified version.

generic

解决方案

  1. 85% 成功率
    pip install --index-url https://main.index package==1.0
  2. 80% 成功率
    pip install --extra-index-url https://extra.index package==1.0
  3. 90% 成功率
    echo 'package==1.0' > constraints.txt && pip install -c constraints.txt package

无效尝试

常见但无效的做法:

  1. 60% 失败

    May lose access to needed packages.

  2. 70% 失败

    Disables all indexes, may not find package.

  3. 80% 失败

    Doesn't resolve version conflict.