标签:style blog http color io os 使用 ar strong
scikit-learn 是一个python实现的免费开源的机器学习算法包,从字面意思可知,science 代表科学,kit代表工具箱,直接翻译过来就是用于机器学习的科学计算包。
安装scikit-learn有两种方式:
(1)安装官方发布的包。
(2)安装第三方开发工具,里边已经包含了scikit-learn。
对于(2),我推荐的是canopy,在mac和windows都比较好用。可以不用考虑安装python,numpy,scipy,因为canopy已经自自带了这些。
scikit-learn需要以下包或者工具:
其实往往我们还需要matplotlib,这个可以非常方便的画图显示数据,可以有matlab一样的效果。
1. Windows下的安装
First you need to install numpy and scipy from their own official installers.
Wheel packages (.whl files) for scikit-learn from PyPI can be installed with the pip utility. Open a console and type the following to install or upgrade scikit-learn to the latest stable release:
pip install -U scikit-learn
If there are no binary packages matching your Python version you might to try to install scikit-learn and its dependencies fromChristoph Gohlke Unofficial Windows installers or from a Python distribution instead.
2. Mac下的安装
Scikit-learn and its dependencies are all available as wheel packages for OSX:
pip install -U numpy scipy scikit-learn
3. Linux下的安装
linux下没有提供像windows和Mac下那样方便的安装包,所以必须手工创建依赖库。
从源码安装需要scikit-learn运行依赖库、python开发头文件,c/c++编译器。
3.1 Under Debian-based operating systems, which include Ubuntu, if you have Python 2 you can install all these requirements by issuing:
如果是python2.6或者python2.7,你可以执行如下的命令:
sudo apt-get install build-essential python-dev python-setuptools python-numpy python-scipy libatlas-dev libatlas3gf-base
如果是python3.3或者python3.4,你可以执行如下的命令:
sudo apt-get install build-essential python3-dev python3-setuptools python3-numpy python3-scipy libatlas-dev libatlas3gf-base
安装matplotlib
sudo apt-get install python-matplotlib
3.2 在centos或者redhad下可以这样安装:
sudo yum -y install gcc gcc-c++ numpy python-devel scipy
3.3. 使用pip安装scikit-learn
pip install --user --install-option="--prefix=" -U scikit-learn
标签:style blog http color io os 使用 ar strong
原文地址:http://www.cnblogs.com/sdlypyzq/p/3968017.html