• 机器学习算法库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


  • 相关阅读:
    python,os操作文件,文件路径(上一级目录)
    python屏幕的交互(读取输出信息)input,raw_input的区别
    Shell script 传参数处理(默认变量)
    python 2.4 的字符串转时间(日期减法取间隔时间)
    java的hashcode(结合hashset讲解)
    μCOS-II系统之事件(event)的使用规则及Semaphore的相互排斥量使用方法
    HDU 1079 Calendar Game (博弈论-sg)
    flume MemoryChannel 源代码解析
    MySQL查询时强制区分大写和小写
    蓝桥杯——真题训练之李白打酒
  • 原文地址:https://www.cnblogs.com/sdlypyzq/p/3968017.html
Copyright © 2020-2023  润新知