python sklearn机器学习库 安装
2015-01-07 11:36
281 查看
1、准备工作
安装sklearn之前,我们需要先安装numpy,scipy函数库。Numpy下载地址:http://sourceforge.net/projects/numpy/files/NumPy
Scipy下载地址:http://sourceforge.net/projects/scipy/files/Scipy
下载对应本机的python版本。
2、安装sklearn机器学习库
下载地址:https://github.com/scikit-learn/scikit-learn下载压缩包之后,解该压缩包压缩。使用CMD进入sklearn文件夹,执行
python setup.py install
即安装完成。
3、报错解决
我们在导入sklearn时往往会报错。>>> import sklearn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "sklearn/__init__.py", line 37, in <module>
from . import __check_build
File "sklearn/__check_build/__init__.py", line 46, in <module>
raise_build_error(e)
File "sklearn/__check_build/__init__.py", line 41, in raise_build_error
%s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
ImportError: No module named _check_build
___________________________________________________________________________
Contents of sklearn/__check_build:
__init__.py __init__.pyc _check_build.c
_check_build.pyx setup.py setup.pyc
___________________________________________________________________________
It seems that scikit-learn has not been built correctly.
If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.
If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.
当我们遇到这种错误时,我建议把Numpy和Scipy两个库重安下,可能之前安装的时间过长导致的。
>>from sklearn import datasets Traceback (most recent call last): File "E:\P\plot_ols.py", line 28, in from sklearn import datasets, linear_model File "C:\Python27\lib\site-packages\sklearn\linear_model\__init__.py", line 12, in from .base import LinearRegression File "C:\Python27\lib\site-packages\sklearn\linear_model\base.py", line 29, in from ..utils.sparsefuncs import mean_variance_axis0, inplace_column_scale ImportError: cannot import name inplace_column_scale当遇到这个错误时,我们应该把以下文件删掉。
python27\Lib\site-packages\sklearn\utils\sparsefuncs.pyd
当我们遇到类似 “ImportError:cannot import name **”这样的问题时,我们运行
pip install -U scikit-learn
这样问题就解决了。。
相关文章推荐
- Python下机器学习库安装经验——numpy、sklearn
- python sklearn机器学习库 安装 及 2个spyder的安装
- Python sklearn机器学习库的安装大坑 抛砖引玉 求大神!
- python3安装sklearn机器学习库
- python sklearn 机器学习库使用
- win32 python3.5 下安装sklearn
- 安装sklearn机器学习库
- python中安装机器学习(sklearn)必要的包和模块
- Python安装机器学习库教程。(例子用的numpy)
- sklearn:Python语言开发的通用机器学习库
- Ubuntu14.04安装mlpy(机器学习库)---python
- 基于python的机器学习库Sklearn
- 给python安装numpy+scipy+sklearn
- python 安装sklearn
- windows64位Python3.5.2基础上,安装numpy、matplotlib、scipy(whl文件)安装tensorflow及sklearn包
- ubuntu14.04安装python3.5以及sklearn
- python matplotlib及sklearn安装
- linux下python安装 nose lapack atlas numpy scipy sklearn
- 在centOS上离安装Python2.7以及numpy,scipy,matplot,sklearn等
- python sklearn安装的一些有帮助的链接