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

- **ID:** `pip/url-invalid-requirement-scheme`
- **领域:** pip
- **类别:** config_error
- **错误码:** `ERROR`
- **验证级别:** ai_generated
- **修复率:** 95%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 21.0 | active | — | — |
| pip 22.0 | active | — | — |
| pip 23.0 | active | — | — |
| pip 24.0 | active | — | — |

## 解决方案

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
   ```

## 无效尝试

- **** — The --trusted-host flag only affects index URLs, not direct URL requirements; the error remains. (90% 失败率)
- **** — Same validation applies to requirements files; pip rejects HTTP URLs everywhere. (100% 失败率)
- **** — The --no-deps flag does not change URL scheme validation; still fails. (100% 失败率)
