# 错误：无法卸载 'numpy'。它是 distutils 安装的项目，因此我们无法准确确定哪些文件属于它，这会导致仅部分卸载。

- **ID:** `python/pip-cannot-uninstall-distutils-installed`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

该包由操作系统包管理器（apt/yum）通过 distutils 安装，因此 pip 没有 RECORD 文件来知道要删除哪些文件。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Create a virtualenv so pip owns the packages:
  python -m venv .venv && source .venv/bin/activate
  pip install numpy
   ```
2. **** (80% 成功率)
   ```
   Force pip to ignore the installed version:
  pip install --ignore-installed numpy
   ```
3. **** (75% 成功率)
   ```
   Remove the OS package first:
  sudo apt-get remove python3-numpy
  pip install numpy
   ```

## 无效尝试

- **** — Upgrade still needs to uninstall the old version first; same error occurs. (85% 失败率)
- **** — Manually deleting files leaves stale metadata in the OS package database and can break system tools. (70% 失败率)
