python sklearn机器学习库 安装 及 2个spyder的安装
2017-04-25 20:13
357 查看
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两个库重安下,可能之前安装的时间过长导致的。
[python] view
plain copy
>>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
这样问题就解决了。。
2.在anaconda中安装2个spyder的指令
conda
create -n py35 python=3.5
conda install -n py35 spyder
conda install -n py35 pyqt=4.10
Windows
64-bit中,我试了“conda install -n py2 spyder”, “py2”为我设置的第二环境!
好文章分享:https://foofish.net/compatible-py2-and-py3.html
相关文章推荐
- python3安装sklearn机器学习库
- Python sklearn机器学习库的安装大坑 抛砖引玉 求大神!
- python sklearn机器学习库 安装
- Python下机器学习库安装经验——numpy、sklearn
- python sklearn 机器学习库使用
- Ubuntu14.04安装mlpy(机器学习库)---python
- python 安装sklearn
- Python开发环境Spyder安装方法
- windows下 python数据分析包 sklearn 安装
- Windows下安装Python机器学习相关的sklearn(scikit-learn)模块
- python sklearn安装的一些有帮助的链接
- python matplotlib及sklearn安装
- linux下python安装 nose lapack atlas numpy scipy sklearn
- Python开发环境Spyder安装方法
- python安装ez_install 和sklearn
- python如何安装spyder?
- 在centOS上离安装Python2.7以及numpy,scipy,matplot,sklearn等
- windows条件下装ipython及其机器学习库python sklearn
- python安装scipy与sklearn模块
- windows下Python集成开发环境-Spyder安装和使用