Python matplotlib installation and error handling

Source: Internet
Author: User
Tags python script

First of All I refer to: http://www.cnblogs.com/lifegoesonitself/p/3443866.html

I have encountered all the questions in this blog post, first of all the general process:

installation of matplotlib

Matplotlib is Python's most famous drawing library, which provides a complete set of command APIs similar to those of MATLAB, and is ideal for interactive

for mapping. Matplotlib installation can be found in the website link http://matplotlib.org/users/installing.html

The following summary steps are as follows :

The Windows platform downloads the. exe format to install directly.

1,python Download the installation .

2, install the version you need (this is based on the Python version of Step 1),matplotlib.

Install the Matplotlib dependent libraries below

3, for the standard version of Python, to use matplotlib, you also need to install the NumPy module, its .

4, Msvcp71.dll, on some systems, you may also need to download the Msvcp71.dll library. Download

This file, unzip it and drag it to the C:\Windows\System32 directory.

5, run a simple program example:

Import Matplotlib.pyplot as Pltplt.plot ([+]) Plt.ylabel (' Some numbers ') plt.show ()

The first error is:importerror:no module named six

To download and install the six module:

https://pypi.python.org/pypi/six/

Download six-1.4.1.tar.gz package, unzip, put the six.py file inside the C disk python27 directory lib. This allows Python to use the six.py library directly.

Then the installation process encountered an error

The following error was found:

Raise Importerror ("Matplotlib requires Dateutil")
Importerror:matplotlib requires Dateutil

This needs dateutil, you can come here. Download installation.

After installing the Dateutil, the following error occurred:

Raise Importerror ("Matplotlib requires pyparsing")
Importerror:matplotlib requires pyparsing

need to pyparsing here . Download installation .

Complete the above steps and run the example above to display our images as shown below.

If you encounter some dependent packages that you need to install during the program installation, you can go to Find here (point me), is indeed a good resource.

According to the need to draw the graphics in the following link to select the corresponding graphic to modify, to draw their own images required.

Example: http://matplotlib.org/examples/index.html , Gallery: http://matplotlib.org/gallery.html

How to solve Chinese garbled characters

Note the resolution for Chinese in drawing, add the following to the header of the. py file:

  1. #-*-Coding:utf-8-*-   
  2. from  PYLAB  import  *  
  3. mpl.rcparams[ ' Font.sans-serif ' ] = [ ' Simhei ' ]  #指定默认字体   
  4. mpl.rcparams[ ' Axes.unicode_minus ' ] =  false   #解决保存图像是负号 '-' Display as a block problem  

I refer to this article Bovenbo the main installation of Python matplotlib required software to Baidu network disk, you can here we go . . Thank bloggers for their selfless sharing!!

drawing script. py to. exe

If you want to be able to publish a Python script as an executable program running out of the Python platform, such as a single EXE file.

You can refer to this blog post: http://blog.csdn.net/daniel_ustc/article/details/15501385


Python matplotlib installation and error handling

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.