The NumPy(Numeric python) system is an open-source numerical extension of Python , a A scientific calculation package implemented by Python. It provides a number of advanced numerical programming tools, such as matrix data types, vector processing, and sophisticated operations libraries. Designed for rigorous digital processing. The content includes: ① a powerful N - dimensional Array object ; Iia relatively mature (broadcast) function library;③a toolkit for consolidating C + + and Fortran code; ④ Practical linear algebra, Fourier transform, and random number generation functions. numpy and sparse matrix Operations Pack scipy are more convenient to use.
SciPy (Scientific Library for Python,pronounced "sigh Pie")is an open source mathematical, scientific, and engineering computing package. It is a convenient, easy-to-use, scientific and engineeredPythontoolkit, including statistics, optimization, integration, linear algebra modules, Fourier transforms, signal and image processing, ordinary differential equation solvers, and more.
Matplotlibis aPythongraphics frame, similar to theMATLABand theRlanguage. It ispythonThe most famous drawing library, it provides a complete set of andmatlaba similar commandAPI, making it ideal for interactive mapping. It can also be conveniently used as a drawing control, embeddedGUIthe application.
Scikit-learnis based onpythonThe machine learning module, based onBSDOpen Source Licensing. Scikit-learnThe basic functions are mainly divided into six parts, classification, regression, clustering, data dimensionality reduction, model selection, data preprocessing, in particular, can refer to the official website of the document.
First Step: Uninstall the original version, including Numpy , Scipy , Matlotlib , Scikit-learn
Pip Uninstall Scikit-learn
Pip Uninstall NumPy
Pip Uninstall scipy
Pip Uninstall Matplotlib
Step two: Do not use or " Easy_install package " install, or go to Baidu download exe but go to the official website to download the corresponding version, the most important part of the installation process is the version needs to be compatible.
step three: Go to Python installation Scripts directory, and then use the pip Install XXX.WHL installation, first load Numpy\scipy\matlotlib package, then install Scikit-learn .
Numpy
: https://pypi.python.org/pypi/numpy/#downloads
I'm not using it here . pip Install NumPy installation, but in Python of the Scripts Catalogue D:\Program files\python27\scripts under Use
pip Install D:\PYTHON64\NUMPY-1.11.2+MKL-CP27-CP27M-WIN_AMD64.WHL command.
The installation was successful.
Scipy
: https://pypi.python.org/pypi/scipy/
installation command: pip Install D:\PYTHON64\SCIPY-0.18.1-CP27-CP27M-WIN_AMD64.WHL .
The installation was successful.
Matplotlib
: https://pypi.python.org/pypi/matplotlib/
installation command: pip Install D:\PYTHON64\MATPLOTLIB-1.5.3-CP27-CP27M-WIN_AMD64.WHL .
The installation was successful.
Scikit-learn
: https://pypi.python.org/simple/scikit-learn/
installation command: pip Install D:\PYTHON64\SCIKIT_LEARN-0.18-CP27-CP27M-WIN_AMD64.WHL
The installation was successful.
Test Run environment
first code: Slash coordinates, test matplotlib
Import Matplotlib
Import NumPy
Import scipy
Import Matplotlib.pyplot as Plt
Plt.plot ([i])
Plt.ylabel (' some numbers ')
Plt.show ()
Operation Result:
The second code: Peach Heart Program, test NumPy and the matplotlib
Code Reference: Windows under Python Easy_install the installation -Kingslanding
Import NumPy as NP
Import Matplotlib.pyplot as Plt
X = Np.arange (-5.0, 5.0, 0.1)
Y = Np.arange (-5.0, 5.0, 0.1)
X, y = Np.meshgrid (x, y)
f = * x * * 2-16 * NP.ABS (x) * y + + * y * * 2-225
Fig = Plt.figure ()
CS = Plt.contour (x, Y, F, 0, colors = ' R ')
Plt.show ()
Operation Result:
Third Program: Display matplotlib powerful drawing interaction capabilities
Code Reference: Python-matplotlib installation and simple use -Bery
Import NumPy as NP
Import Matplotlib.pyplot as Plt
N = 5
Menmeans = (20, 35, 30, 35, 27)
MENSTD = (2, 3, 4, 1, 2)
IND = Np.arange (N) # The X locations for the groups
width = 0.35 # The width of the bars
Fig, ax = plt.subplots ()
Rects1 = Ax.bar (Ind, Menmeans, Width, color= ' R ', YERR=MENSTD)
Womenmeans = (25, 32, 34, 20, 25)
WOMENSTD = (3, 5, 2, 3, 3)
Rects2 = Ax.bar (Ind+width, Womenmeans, width, color= ' y ', yerr=womenstd)
# Add some
Ax.set_ylabel (' Scores ')
Ax.set_title (' Scores by group and Gender ')
Ax.set_xticks (Ind+width)
Ax.set_xticklabels (' G1 ', ' G2 ', ' G3 ', ' G4 ', ' G5 ')
Ax.legend ((Rects1[0], rects2[0]), (' Men ', ' women '))
def autolabel (rects):
# Attach some text labels
For rect in rects:
Height = rect.get_height ()
Ax.text (rect.get_x () +rect.get_width ()/2., 1.05*height, '%d '%int (height),
Ha= ' center ', va= ' bottom ')
AutoLabel (RECTS1)
AutoLabel (RECTS2)
Plt.show ()
Operation Result:
Fourth code: Matrix data Set, testing Sklearn
From Sklearn import datasets
Iris = Datasets.load_iris ()
digits = Datasets.load_digits ()
Print Digits.data
Operation Result:
ImportError:numpy.core.multiarray failed to import
PythoninstallationNumPywhen the error occurs, this passStackOverflowand Baidu is also neededpythonversion andNumPyversions are consistent, and the methods addressed include"Pip install-u numpy"upgrade or download a specific version"Pip Install numpy==1.8". But this obviously also involves more packages, without the previous uninstall download installed in the unified version of theWHLreliable.
Microsoft Visual C + + 9.0 is required (unable to find Vcvarsall.bat)
becauseNumpythe internal matrix operation isClanguage implementation, so you need to install the build tool, which is installed on the computerVC +orVS2012about, Workaround: If you have installedVisual Studiothe environment variable is addedVs90comntoolscan, differentVSThe version corresponds to different environment variable values:
Visual Studio (VS10)Setvs90comntools=%vs100comntools%
Visual Studio (VS11)Setvs90comntools=%vs110comntools%
Visual Studio (VS12)Setvs90comntools=%vs120comntools%
but that doesn't work, and the other way is to downloadMicorsoft Visual C + + Compiler for Python 2.7the package.
PS : These problems are based on the basic solution used Pip upgrade, version consistent, re-download the relevant version files and then install.
Numpy+scipy+matlotlib+scikit-learn Installation and Problem solving