為使用Scikit-learn搭建環(huán)境(window/Mac)

安裝目錄

1. python

2. Ipython

3. qtconsole

4. Numpy

5. Scipy

6. matplotlib

7. scikit-learn

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

Windows用戶

下載,安裝

正確設(shè)置PATH變量:進(jìn)入 computer > Control Panel > All Control Panel Items > System > Advanced system setting > environment variables,然后點(diǎn)擊 "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以及相關(guān)需要的其他包:

jinja2needed for the notebook

sphinxneeded for nbconvert

pyzmqneeded for IPython’s parallel computing features, qt console and notebook

pygmentsused by nbconvert and the Qt console for syntax highlighting

tornadoneeded by the web-based notebook

noseused by the test suite

readline (on OS X) or pyreadline (on Windows)needed for the terminal

還有一些不能通過pip安裝,需要單獨(dú)安裝比如:Qt, PyQt 和 pandoc

2.2 獨(dú)立安裝

2.2.1 安裝Ipython本身

Windows用戶

install setuptools

$ python -m pip install pyreadline

$ python -m pip install ipython

Mac用戶

pip install ipython

2.2.2 安裝基礎(chǔ)相關(guān)包(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貌似還挺強(qiáng)大的,這里來不及深入,以后有時間會好好研究一下

更多信息,參考Ipython官網(wǎng)

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工具包,提供了豐富的數(shù)據(jù)繪圖工具。

Windows用戶

下載地址

Mac用戶

下載地址

注: 使用命令pip list查看除了matplotlib你是否還安裝了:

setuptools

numpy

Python-dateutil

pytz

pyparsing

7. 安裝 scikit-learn

scikit-learn

scikit-learn是用于機(jī)器學(xué)習(xí)的Python工具包

為數(shù)據(jù)挖掘和數(shù)據(jù)分析提供簡單高效的工具

基于NumPy, SciPy, 和 matplotlib

開源,BSD license

Scikit-learn需要環(huán)境:

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!

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容