To import the script directory in the Python installation directory into the environment variable path
650) this.width=650; "title=" environment variable changed. png "alt=" Wkiol1gdbcuaxh7aaap1irittqc796.png "src=" http://s1.51cto.com/wyfs02/ M02/89/cd/wkiol1gdbcuaxh7aaap1irittqc796.png "/>
"In Windows DOS Window execution: pip
"will show information about PIP.
650) this.width=650; "title=" Pip.png "alt=" Wkiom1gdbk3hoq5uaac6e0dpfei717.png "src=" http://s2.51cto.com/wyfs02/M00 /89/cf/wkiom1gdbk3hoq5uaac6e0dpfei717.png "/>
is performed in the DOS interface in Windows: Pip install Nump
The system will automatically download the Nump package and complete the appropriate installation
650) this.width=650; "title=" Pipinstall.png "alt=" Wkiol1gdbsdhg-ukaacij34cmge518.png "src=" http://s2.51cto.com/ Wyfs02/m00/89/cd/wkiol1gdbsdhg-ukaacij34cmge518.png "/>
"Because I have installed it, so there will be no download progress bar (Note: The download is relatively slow)
Premise: You have installed the python3.5.2
"python3.5.2 download Link: Python official website
"Test Case:
# 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
This article is from the "11907893" blog, please be sure to keep this source http://11917893.blog.51cto.com/11907893/1869760
Install nump with the pip command of Python