简体   繁体   English

scikit-learn错误虽然安装正确

[英]scikit-learn error although it is properly installed

My code is as follows:我的代码如下:

from imblearn import over_sampling

I get this error:我收到此错误:

cannot import name 'DistanceMetric' from 'sklearn.metrics'

A simple import on imblearn is giving the same error.对 imblearn 的简单导入给出了相同的错误。 I tried reinstalling scikit learn and scipy, but I still get the same error.我尝试重新安装 scikit learn 和 scipy,但我仍然遇到同样的错误。

Since it is working fine on my computer, it must be your installation.既然它在我的电脑上运行良好,那一定是你的安装。 Try uninstalling scikit-learn before reinstalling.在重新安装之前尝试卸载 scikit-learn。

Edit: If that is not working I would try running: python -m pip show scikit-learn编辑:如果这不起作用,我会尝试运行:python -m pip show scikit-learn

uninstall sklearn, delete the directory for sklearn, reboot the computer, and reinstall sklearn.卸载sklearn,删除sklearn所在目录,重启电脑,重新安装sklearn。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM