执行命令 pip uninstall scikit-learn 报错,Cannot uninstallscikitlearn

具体报错如下
ERROR: Cannot uninstall 'scikit-learn'. 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.
不能卸载scikit-learn”。这是一个安装distutils项目,因此不能准确地确定哪些文件属于它,这将导致只有部分卸载
原因

概率是其他依赖包含scikitlearn,如kerastensorflow

解决办法

先从本地文件夹搜索kerastensorflow等包中是否包含scikitlearn
若是,则先把这些包卸载掉,然后找到删除虚拟环境(以anaconda虚拟环境为例)中的scikit-learn * .egg-info文件
最后重新安装需要版本scikit-learn,再安装其他被卸载的依赖包(如keras即可

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注