ERROR pip config_error ai_generated true

错误:无效的需求:'http://example.com/package.zip' - 期望 file://、https:// 或有效的包名称。

ERROR: Invalid requirement: 'http://example.com/package.zip' - Expected file://, https://, or a valid package name.

ID: pip/url-invalid-requirement-scheme

其他格式: JSON · Markdown 中文 · English
95%修复率
88%置信度
1证据数
2023-05-12首次发现

版本兼容性

版本状态引入弃用备注
pip 21.0 active
pip 22.0 active
pip 23.0 active
pip 24.0 active

根因分析

出于安全原因,pip 不支持使用纯 HTTP URL 安装包;只允许 HTTPS、file:// 或包名称。

English

pip does not support plain HTTP URLs for package installation due to security reasons; only HTTPS, file://, or package names are allowed.

generic

官方文档

https://pip.pypa.io/en/stable/topics/secure-installs/

解决方案

  1. Change the URL to HTTPS: pip install https://example.com/package.zip (if HTTPS is available).
  2. Download the file manually and install from local: wget http://example.com/package.zip && pip install ./package.zip
  3. Use a local file server with HTTPS or serve over file://: pip install file:///path/to/package.zip

无效尝试

常见但无效的做法:

  1. 90% 失败

    The --trusted-host flag only affects index URLs, not direct URL requirements; the error remains.

  2. 100% 失败

    Same validation applies to requirements files; pip rejects HTTP URLs everywhere.

  3. 100% 失败

    The --no-deps flag does not change URL scheme validation; still fails.