python config_error ai_generated true

警告:requirements文件中存在重复条目:第3行numpy==1.21.0和第5行numpy==1.22.0

WARNING: Duplicate entry in requirements file: numpy==1.21.0 (line 3) and numpy==1.22.0 (line 5)

ID: python/pip-requirements-duplicate-entry

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

版本兼容性

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

根因分析

requirements文件中同一包列出了不同版本,导致歧义。

English

The same package is listed with different versions in the requirements file, causing ambiguity.

generic

解决方案

  1. 95% 成功率 Remove duplicate and keep only one version
    # Edit requirements.txt to keep only one line
    numpy==1.22.0
  2. 90% 成功率 Use pip-compile to resolve dependencies automatically
    pip install pip-tools
    pip-compile requirements.in

无效尝试

常见但无效的做法:

  1. Keeping both entries 50% 失败

    Pip will use the last occurrence, which may not be intended.

  2. Ignoring the warning 60% 失败

    May install unexpected version; conflicts later.