简体   繁体   中英

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. I tried reinstalling scikit learn and scipy, but I still get the same error.

Since it is working fine on my computer, it must be your installation. Try uninstalling scikit-learn before reinstalling.

Edit: If that is not working I would try running: python -m pip show scikit-learn

uninstall sklearn, delete the directory for sklearn, reboot the computer, and reinstall sklearn.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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