利用Python的pip命令安裝nump

來源:互聯網
上載者:User

標籤:python   nump   

》將python安裝目錄中的script的目錄匯入到環境變數path中

650) this.width=650;" title="環境變數更改.png" alt="wKioL1gdbcuAxh7AAAP1IrItTQc796.png" src="http://s1.51cto.com/wyfs02/M02/89/CD/wKioL1gdbcuAxh7AAAP1IrItTQc796.png" />


》在Windows的DOS視窗執行:pip

    》》將出現pip的相關資訊

650) this.width=650;" title="pip.png" alt="wKiom1gdbk3hOq5uAAC6E0dPfeI717.png" src="http://s2.51cto.com/wyfs02/M00/89/CF/wKiom1gdbk3hOq5uAAC6E0dPfeI717.png" />

》在Windows中的DOS介面中執行:pip install nump

    》》系統會自動下載nump包,並且完成相應的安裝

650) this.width=650;" title="pipinstall.png" alt="wKioL1gdbsDhG-UkAACij34cmgE518.png" src="http://s2.51cto.com/wyfs02/M00/89/CD/wKioL1gdbsDhG-UkAACij34cmgE518.png" />

    》》因為,我已經安裝過啦,所以不會出現下載的進度條(註:下載比較緩慢)

》前提:你已經安裝了python3.5.2

    》》python3.5.2下載連結:python官網

》測試案例:

# import the necessary packagesimport numpy as npdef chi2_distance(histA, histB, eps = 1e-10):        # compute the chi-squared distance    d = 0.5 * np.sum([((a - b) ** 2) / (a + b + eps)        for (a, b) in zip(histA, histB)])    Sum = 0;    for (a,b) in zip(histA, histB):        E  = ((a - b) ** 2) / (a + b + eps)        Sum += E        print Sum/2    # return the chi-squared distance    return dd = chi2_distance([0,1,2,3,4],[4,3,2,1,0])# print d


本文出自 “11907893” 部落格,請務必保留此出處http://11917893.blog.51cto.com/11907893/1869760

利用Python的pip命令安裝nump

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.