python install_error ai_generated true

错误:无法卸载 'numpy'。它是通过 distutils 安装的项目,因此我们无法准确判断哪些文件属于它,这会导致仅部分卸载。

ERROR: Cannot uninstall 'numpy'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

ID: python/pip-requirement-already-satisfied-but-wrong-version

其他格式: JSON · Markdown 中文 · English
80%修复率
88%置信度
0证据数
2024-08-22首次发现

版本兼容性

版本状态引入弃用备注
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

根因分析

该包由操作系统包管理器(apt/dnf)或旧式 distutils 路径安装,因此 pip 没有 RECORD 文件来执行干净的卸载。

English

The package was installed by the OS package manager (apt/dnf) or an old distutils path, so pip has no RECORD file to drive a clean uninstall.

generic

解决方案

  1. 90% 成功率
    Remove the OS-managed copy first: `sudo apt-get remove python3-numpy` (or `dnf remove python3-numpy`), then `pip install numpy` inside a venv.
  2. 93% 成功率
    Work in a fresh venv that does not inherit system site-packages: `python -m venv --system-site-packages=false .venv`.

无效尝试

常见但无效的做法:

  1. 70% 失败

    Leaves two overlapping copies in site-packages; imports become order-dependent and hard to debug.

  2. 85% 失败

    The distutils guard still triggers; sudo does not create a RECORD file.