为使用Scikit-learn搭建环境(window/Mac)
admin
2023-07-30 20:42:36
0

安装目录

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安装

  • Windows用户
    下载 PyQt4 for python2.7 windows 32bit
  • Mac用户
    • 下载SIP包
    • 下载Qt包
    • 下载PyQt4包
    • 安装 Qt
    • 安装 SIP
    • 安装 PyQt

4. 安装 Numpy

  • Windows用户
    下载地址
  • Mac用户
    $ pip install numpy

5. 安装 Scipy

  • Windows用户
    下载地址
  • Mac用户
    $ pip install scipy
    或者下载地址

6. 安装 matplotlib


matplotlib

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

  • Windows用户
    下载地址
  • Mac用户
    下载地址

注: 使用命令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!

相关内容

热门资讯

500 行 Python 代码... 语法分析器描述了一个句子的语法结构,用来帮助其他的应用进行推理。自然语言引入了很多意外的歧义,以我们...
定时清理删除C:\Progra... C:\Program Files (x86)下面很多scoped_dir开头的文件夹 写个批处理 定...
65536是2的几次方 计算2... 65536是2的16次方:65536=2⁶ 65536是256的2次方:65536=256 6553...
Mobi、epub格式电子书如... 在wps里全局设置里有一个文件关联,打开,勾选电子书文件选项就可以了。
scoped_dir32_70... 一台虚拟机C盘总是莫名奇妙的空间用完,导致很多软件没法再运行。经过仔细检查发现是C:\Program...
pycparser 是一个用... `pycparser` 是一个用 Python 编写的 C 语言解析器。它可以用来解析 C 代码并构...
小程序支付时提示:appid和... [Q]小程序支付时提示:appid和mch_id不匹配 [A]小程序和微信支付没有进行关联,访问“小...
微信小程序使用slider实现... 众所周知哈,微信小程序里面的音频播放是没有进度条的,但最近有个项目呢,客户要求音频要有进度条控制,所...
python绘图库Matplo... 本文简单介绍了Python绘图库Matplotlib的安装,简介如下: matplotlib是pyt...
Prometheus+Graf... 一,Prometheus概述 1,什么是Prometheus?Prometheus是最初在Sound...