问题描述
当使用pip安装包时,可能会遇到下面的错误:
ERROR: Cannot uninstall 'wrapt'. 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.
这个错误的意思是:无法卸载“wrapt”。因为它是通过“distutils”安装的项目,所以无法准确确定哪些文件属于它,这将导致只能进行部分卸载。
这个错误该如何解决呢?其实很简单,不管是wrapt还是llvmlite或者其他包,只要错误描述类似上文,都可以通过本文的方法解决。
解决办法
首先找到wrapt安装包的位置,命令如下:
pip show wrapt
执行该命令后,你将见到类似如下的输出:
Name: wrapt
Version: 1.10.11
Summary: Module for decorators, wrappers and monkey patching.
Home-page: https://github.com/GrahamDumpleton/wrapt
Author: Graham Dumpleton
Author-email: Graham.Dumpleton@gmail.com
License: BSD
Location: d:\programdata\anaconda3\lib\site-packages
Requires:
Required-by: astroid
如上,我们可以看到,wrapt包安装路径为:d:\programdata\anaconda3\lib\site-packages。
我们要做的事就是进入该目录,删除掉wrapt的所有安装内容,在此处,包括如下内容:
注意,在删除的时候wrapt文件夹和wrapt-1.10.11-py3.7.egg-info文件都必须删除。如果wrapt-1.10.11-py3.7.egg-info并未删除,再次卸载的时候依然会报同样的错误。