Python:windows下scikit-learn 安装和更新

scikit-learn 报错:

from sklearn.model_selection import train_test_split ImportError: No module named model_selection报错的原因是我conda里的sklearn版本是0.17,没有model_selection这个模块,升级到0.18就好了

搜到的几个解决方法:

http://blog.csdn.net/hh12211221/article/details/54375387

http://stackoverflow.com/questions/36840496/conda-update-scikit-learn-also-scipy-and-numpy

另附官方文档:

Installing scikit-learn — scikit-learn 0.18.1 documentation http://scikit-learn.org/stable/install.html

1、首先用Pip指令更新:

pip install -U scikit-learn结果说已经更新了:Requirement already up-to-date: scikit-learn in c:\program files\anaconda2\lib\site-packages

2、用conda更新也可以:

conda install scikit-learnconda update scikit-learnconda remove scikit-learn在使用 install 命令后:Error: HTTPError: 403  Forbidden 

http://repo.continuum.io/pkgs/pro/win-64/

然后又使用update命令:Error: package 'scikit-learn' is not installed in C:\Program Files\Anaconda2说明scikit-learn不是用conda安装的,应该是用pip安装的。

3、删除后重装

1)我先用conda remove命令移除了scikit-learn 安装包,又用pip uninstall 命令移除了一遍(管他是用什么安装的,总之都移除一遍)2)然后如果继续安装还是有问题,就暴力删除一遍。进入C:\Program Files\Anaconda2\Lib\site-packages\sklearn 目录,把这两个文件夹删除。

scikit-learn1

3)然后在用pip命令安装,这次终于装上了0.18版本。

中间的报错是因为用公司的网络有限制,后来换了手机热点才正常下载了。

 

Image 2

 

posted @ 2018-07-15 15:16  不锈钢老鼠  阅读(11409)  评论(0编辑  收藏  举报