美文网首页技术pythonPythoner集中营
为使用Scikit-learn搭建环境(window/Mac)

为使用Scikit-learn搭建环境(window/Mac)

作者: Jason_Yuan | 来源:发表于2015-05-31 09:29 被阅读4145次

    安装目录###

    1. python
    2. Ipython
    3. qtconsole
    4. Numpy
    5. Scipy
    6. matplotlib
    7. scikit-learn


    1. 安装 python2.7 (or python3.4)

    • Windows用户
    • 下载,安装
    • 正确设置PATH变量:进入 computer > Control Panel > All Control Panel Items > System > Advanced system setting > environment variables,然后点击 "Path" 然后添加 ";\C:\Python27"(或者Python33)
    • 这样就可以在命令行界面(CLI)打开Python
    • Mac用户
    • Mac自带Python2.7
    • 可以先安装Homebrew,命令$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)",然后再安装Python3.4,命令$ brew install python3

    2. 安装 Ipython

    Ipython

    2.1 整体安装

    • Windows用户
      $ python -m pip install ipython[all]

    • Mac用户
      $ pip install ipython[all]

    • [all] 意味着会下载并安装Ipython以及相关需要的其他包:
      jinja2 needed for the notebook
      sphinx needed for nbconvert
      pyzmq needed for IPython’s parallel computing features, qt console and notebook
      pygments used by nbconvert and the Qt console for syntax highlighting
      tornado needed by the web-based notebook
      nose used by the test suite
      readline (on OS X) or pyreadline (on Windows) needed for the terminal

    • 还有一些不能通过pip安装,需要单独安装比如:Qt, PyQt 和 pandoc

    2.2 独立安装

    2.2.1 安装Ipython本身

    • Windows用户
      install setuptools
      $ python -m pip install pyreadline
      $ python -m pip install ipython

    • Mac用户
      pip install ipython

    2.2.2 安装基础相关包(Basic optional dependencies )

    • readline (for command line editing, tab completion, etc.)
      python -m pip install "ipython[terminal]"

    • nose (to run the IPython test suite)
      python -m pip install "ipython[test]"

    • pyzmq (for IPython.parallel (parallel computing))
      python -m pip install "ipython[parallel]"

    • notebook (Dependencies for the IPython HTML notebook)
      python -m pip install "ipython[notebook]"

    • IPython notebook使用web的形式,使用时输入ipython notebook

    • 支持IPython notebook的浏览器有:
      Chrome ≥ 13
      Safari ≥ 5
      Firefox ≥ 6

    • Ipython notebook貌似还挺强大的,这里来不及深入,以后有时间会好好研究一下

    更多信息,参考Ipython官网


    3. 安装 qtconsole

    包含:pyzmq、pygments 和 PyQt(or PySide)

    $ pip install pyzmq pygments
    Shortcut:
    $ pip install "ipython[qtconsole]"

    PyQt/PySide不能通过pip安装


    4. 安装 Numpy


    5. 安装 Scipy


    6. 安装 matplotlib

    matplotlib

    matplotlib是基于numpy的一套Python工具包,提供了丰富的数据绘图工具。

    注: 使用命令pip list查看除了matplotlib你是否还安装了:
    setuptools
    numpy
    Python-dateutil
    pytz
    pyparsing


    7. 安装 scikit-learn

    scikit-learn
    • scikit-learn是用于机器学习的Python工具包
    • 为数据挖掘和数据分析提供简单高效的工具

    • 基于NumPy, SciPy, 和 matplotlib

    • 开源,BSD license

    • Scikit-learn需要环境:
      Python (>= 2.6 or >= 3.3)
      Numpy (>= 1.6.1)
      Scipy (>= 0.9)

    • Windows用户
      python -m pip install -U scikit-learn

    • Mac用户
      pip install -U scikit-learn

    大功告成,play with data and have fun!

    相关文章

      网友评论

      • 秋纫:Fedora:
        sudo dnf install scikit-learn
        simoncos:@秋纫 噗 噗 噗
        秋纫:@赵澈 看手册 看手册 看手册
        simoncos:@秋纫 最近Project要用這個庫,有啥經驗指教?

      本文标题:为使用Scikit-learn搭建环境(window/Mac)

      本文链接:https://www.haomeiwen.com/subject/zgtdqttx.html