# 错误：包 'X' 没有 'pyproject.toml' 或 'setup.py'

- **ID:** `pip/package-has-no-pyproject-toml-or-setup-py`
- **领域:** pip
- **类别:** install_error
- **错误码:** `ERROR`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

该包要么不是有效的 Python 包，要么索引 URL 错误，或者包名拼写错误，导致 pip 无法找到任何构建元数据。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 21.3+ | active | — | — |
| Python 3.7-3.12 | active | — | — |

## 解决方案

1. ```
   pip install --no-index --find-links=/path/to/wheels <包名>
   ```
2. ```
   pip install <包名>==<确切版本> --only-binary=:all:
   ```
3. ```
   pip install <包名> -i https://pypi.org/simple/ --trusted-host pypi.org
   ```

## 无效尝试

- **Installing the package with --no-build-isolation flag** — The flag only disables build isolation; if the package has no build files at all, this still fails. (95% 失败率)
- **Upgrading pip to the latest version** — The error is about missing package metadata, not pip's resolver or version compatibility. (90% 失败率)
- **Running pip install with --verbose to get more details** — Verbose output does not provide missing build files; the root cause remains the same. (85% 失败率)
