python system_error ai_generated true

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

ERROR: Cannot uninstall 'pkg'. 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-cannot-uninstall

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

版本兼容性

版本状态引入弃用备注
3.5 active
3.6 active
3.7 active

根因分析

该包是使用 distutils(或旧的 setup.py install)安装的,pip 无法跟踪其文件以进行干净卸载。

English

The package was installed with distutils (or old setup.py install), and pip cannot track its files for clean removal.

generic

解决方案

  1. 80% 成功率
    pip install --ignore-installed pkg
  2. 70% 成功率
    rm -rf /path/to/site-packages/pkg* /path/to/site-packages/pkg-*.egg-info

无效尝试

常见但无效的做法:

  1. 90% 失败

    Pip doesn't have a --force uninstall; it will still fail.

  2. 40% 失败

    Risky and may leave residual files.