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
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.
官方文档
https://pip.pypa.io/en/stable/topics/secure-installs/解决方案
-
Change the URL to HTTPS: pip install https://example.com/package.zip (if HTTPS is available).
-
Download the file manually and install from local: wget http://example.com/package.zip && pip install ./package.zip
-
Use a local file server with HTTPS or serve over file://: pip install file:///path/to/package.zip
无效尝试
常见但无效的做法:
-
90% 失败
The --trusted-host flag only affects index URLs, not direct URL requirements; the error remains.
-
100% 失败
Same validation applies to requirements files; pip rejects HTTP URLs everywhere.
-
100% 失败
The --no-deps flag does not change URL scheme validation; still fails.