机器学习算法库scikit-learn的安装

  scikit-learn 是一个python实现的免费开源的机器学习算法包,从字面意思可知,science 代表科学,kit代表工具箱,直接翻译过来就是用于机器学习的科学计算包。

  安装scikit-learn有两种方式:

  (1)安装官方发布的包。

  (2)安装第三方开发工具,里边已经包含了scikit-learn。

对于(2),我推荐的是canopy,在mac和windows都比较好用。可以不用考虑安装python,numpy,scipy,因为canopy已经自自带了这些。

 

 

scikit-learn需要以下包或者工具:

  • Python (>= 2.6 or >= 3.3),
  • NumPy (>= 1.6.1),
  • SciPy (>= 0.9).

其实往往我们还需要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或者redhat下可以这样安装:

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

 



转载于:https://www.cnblogs.com/sdlypyzq/p/3968017.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值