python config_error ai_generated true

错误:无效的要求:'-e git+https://github.com/user/repo.git#egg=package' - 期望有效的需求名称

ERROR: Invalid requirement: '-e git+https://github.com/user/repo.git#egg=package' - Expected a valid requirement name

ID: python/pip-requirements-file-parse-error

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

版本兼容性

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

根因分析

requirements.txt 中的可编辑安装格式格式错误,通常缺少 -e 标志或 URL 语法不正确。

English

The editable install format in requirements.txt is malformed, often missing the -e flag or incorrect URL syntax.

generic

解决方案

  1. 95% 成功率 Use the correct editable install format
    In requirements.txt: `-e git+https://github.com/user/repo.git#egg=package` (ensure no extra characters).
  2. 90% 成功率 Install directly with pip using the -e flag
    `pip install -e git+https://github.com/user/repo.git#egg=package`

无效尝试

常见但无效的做法:

  1. Removing the -e flag and treating it as a regular URL 60% 失败

    Without -e, pip will try to install from the URL but may not handle it as an editable install.

  2. Adding extra spaces around the URL 80% 失败

    The syntax is strict; extra spaces may break parsing.