解决无法安装更新python库scikit-learn

This library scikit-learn in python I need to use, but the version is too low now, so I should upgrade!
When I just use this command:

 pip install --upgrade scikit-learn

The error is showed:

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.

SOLUTION!!

Other solutions are helpless.

 pip install --upgrade --force-reinstall --user scikit-learn

Different version of scikit-learn

If you want to import train_test_split:

  • before v0.18
from sklearn.cross_validation import train_test_split
  • from v0.18
 from sklearn.model_selection import train_test_split

references:
https://github.com/pypa/pip/issues/4538
https://stackoverflow.com/questions/40704484/importerror-no-module-named-model-selection

发布了16 篇原创文章 · 获赞 1 · 访问量 259

猜你喜欢

转载自blog.csdn.net/weixin_45366564/article/details/103789868