Machine Learning Combat Environment configuration: Install NumPy, scipy, and matplotlib libraries under Windows systems

Source: Internet
Author: User

In the field of science and finance, the library of scientific functions such as scipy and NumPy implements vector and matrix operations, increases the readability of the code and lowers the reading threshold, while the two libraries are written using the underlying language (c and Fortran), which improves the computational performance of the application and is widely used. There are also drawing tools matplotlib, which can be used to draw 2d/3d graphics, and also to deal with the patterns that are often employed in scientific research.

Three libraries of the respective ↓

Http://sourceforge.net/projects/numpy/files/NumPy

Http://sourceforge.net/projects/scipy/files/Scipy

Https://sourceforge.net/projects/matplotlib/files/matplotlib

Folder can be clicked in, find and your Python version corresponding to the exe file left click Download and install. After the installation is complete, you can select Import to check if the installation is successful.

matplotlib need to rely on many other scientific computing third-party libraries , so it is cumbersome to install.

Installation of Matplotlib problems and solutions (note also need to install the NumPy in advance, Bo Master has been in advance):

If you touch Importerror:no module named six

Install scipy, then copy six.py Six.pyc six.pyo three files from C:\Python27\Lib\site-packages\scipy\lib to C:\Python27\Lib\ The Site-packages directory.

The previous method may be problematic because the six version is too low. So we need to install six.

There are two kinds of installation methods, one is download. WHL then quickly installs with Pip, and one is to download the compressed package, unzip it into the folder to perform the Python setup.py install

The second method used by bloggers ... Of course we need to install Setuptools before running setup.py. On this website: https://pypi.python.org/pypi/setuptools/0.9.8

Look for Windows, click Ez_setup.py to enter, and copy the content down and save it as a local Python script, such as: easy_install.py

Run... Download the installation package automatically until the installation is successful.

Import again to find Importerror:matplotlib requires Dateutil

Dateutil official website Download: https://pypi.python.org/pypi/python-dateutil/1.4.1

To the unzip directory, execute the Python setup.py install installation successfully

Well, now the stumbling block in front of us is importerror:matplotlib requires pyparsing

This directly under the. exe file is available. Https://sourceforge.net/projects/pyparsing/files/pyparsing

Finally saw the import matplotlib no error ...

Run a program to test it! Source code from http://my.oschina.net/bery/blog/203595

Import NumPy as Npimport matplotlib.pyplot as Pltn = 5menMeans = (   2, 3, 4, 1, 2) IND = NP, MENSTD Arange (N)  # The X locations for the groupswidth = 0.35       # The width of the barsfig, ax = plt.subplots () rects1 = ax. Bar (Ind, Menmeans, Width, color= ' R ', yerr=menstd) Womenmeans = (   3, 5, 2, 3, 3) WOMENSTD = (a) X.bar (Ind+width, Womenmeans, width, color= ' y ', yerr=womenstd) # Add Someax.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 ()

The result of the operation came out this way. is not Meng da!

Machine Learning Combat Environment configuration: Install NumPy, scipy, and matplotlib libraries under Windows systems

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.