如何卸载通过Distils安装的pycocotools

时间:2019-10-09 05:47:40

标签: uninstall distutils pycocotools

我在系统中使用Distils安装了pycocotools版本。我想从另一个具有最新更改并且已解决问题的存储库中进行构建和安装。但是我收到以下错误。您知道如何解决此问题吗?

(base) root@tf-notebook-nirandi-855bcb7b58-wxsc9:/notebooks/shared-datasets/shared-datasets/demos/mask-r-cnn# pip install -e git+https://github.com/waleedka/coco.git#egg=coco\&subdirectory=PythonAPI
Obtaining coco from git+https://github.com/waleedka/coco.git#egg=coco&subdirectory=PythonAPI
  Cloning https://github.com/waleedka/coco.git to ./src/coco
  Running command git clone -q https://github.com/waleedka/coco.git /notebooks/shared-datasets/shared-datasets/demos/mask-r-cnn/src/coco
  WARNING: Generating metadata for package coco produced metadata for project name pycocotools. Fix your #egg=coco fragments.
Installing collected packages: pycocotools
  Found existing installation: pycocotools 2.0
ERROR: Cannot uninstall 'pycocotools'. 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.

enter image description here

1 个答案:

答案 0 :(得分:0)

我在这里发布最终解决方案。

第 1 步:升级您的 pip。

python -m pip install --upgrade pip

Step2:找到安装的pycocotools的路径。一个简单的尝试是重新安装 pycocotools,pip 会给你路径

 pip install pycocotools

你会得到

Requirement already satisfied: pycocotools in /home/frank/.local/lib/python3.7/site-packages

现在,我们知道 pkg 位于 /home/frank/.local/lib/python3.7/site-packages

Step3:删除相关文件。

cd /home/frank/.local/lib/python3.7/site-packages
rm -rf pycocotools
rm -rf pycocotools-2.0-py3.7.egg-info 

结束。

然后你可以重新安装最新版本的 pycocotools 或者永远不会被这个困扰。