# 错误：无法卸载要求 '<package>'，未安装。它仅作为可编辑包安装。

- **ID:** `pip/req-uninstall-editables-only`
- **领域:** pip
- **类别:** install_error
- **错误码:** `ERROR`
- **验证级别:** ai_generated
- **修复率:** 78%

## 根因

当用户尝试使用非可编辑说明符或版本不匹配来卸载一个通过 `-e`（可编辑）模式安装的包时，pip 拒绝卸载。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 21.3 | active | — | — |
| pip 22.0.4 | active | — | — |
| pip 23.2 | active | — | — |

## 解决方案

1. ```
   首先以非可编辑模式重新安装包，然后卸载：`pip install <package> --force-reinstall --no-deps` 接着 `pip uninstall <package> -y`
   ```
2. ```
   使用来自 `pip show <package>` 的确切可编辑路径运行 `pip uninstall <package> -y`（例如 `pip uninstall -e /home/user/myproject`）。示例：`pip uninstall -e /home/user/myproject`
   ```

## 无效尝试

- **** — The flag only affects dependency resolution, not the uninstall target itself; pip still checks if the package is installed as editable. (95% 失败率)
- **** — The editable install is a symlink or .pth file, not a full copy; deleting the directory leaves the .pth file, causing pip to still see the package as installed. (80% 失败率)
