標籤: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