機器學習演算法庫scikit-learn的安裝

來源:互聯網
上載者:User

標籤:style   blog   http   color   io   os   使用   ar   strong   

  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或者redhad下可以這樣安裝:

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

 



機器學習演算法庫scikit-learn的安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.