程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python Matplotlib installation and error handling

編輯:Python

Hello everyone , I meet you again , I'm your friend, Quan Jun .

First of all, my reference is :http://www.cnblogs.com/lifegoesonitself/p/3443866.html

I have encountered all the problems in this blog post , The first is the general process :

Matplotlib Installation

matplotlib yes python The most famous gallery , It offers a complete set and matlab Similar orders API, Great for interactively

Mapping .Matplotlib Please refer to The website links http://matplotlib.org/users/installing.html

The following steps are summarized :

windows On the platform download .exe Format Direct installation .

1,python Download and install Download address .

2, Install the version you need ( This should follow the steps 1 Of python edition ) Of Matplotlib, Download address .

The following installation Matplotlib Dependent Library

3, For the Standard Version Python Come on , To use Matplotlib, It also needs to be installed numpy modular , Download address .

4, msvcp71.dll, On some systems , You may also need download msvcp71.dll library . download

This file , Unzip it and drag it to c:\windows\system32 Directory .

5, Run a simple program example :

import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.ylabel('some numbers')
plt.show()

The first mistake is :ImportError: No module named six

Need to download and install six modular :

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

download six-1.4.1.tar.gz package , decompression , The inside six.py Files in c disc python27 The directory Lib Next . such python You can use this directly six.py The library .

Then the errors encountered during the installation process

The following error was found :

raise ImportError(“matplotlib requires dateutil”) ImportError: matplotlib requires dateutil

This needs to be dateutil, You can come here download install .

hold dateutil After installation, the following error occurs again :

raise ImportError(“matplotlib requires pyparsing”) ImportError: matplotlib requires pyparsing

need pyparsing Come here download install .

Complete the above steps , Run the above example to display our image , As shown below .

In the process of program installation, if you encounter some dependent packages that need to be installed , You can go to Look here for ( Am I ), It's really a good resource .

According to the needs of the drawing Select the appropriate graphic in the link below Make changes , Draw the image you need .

example: http://matplotlib.org/examples/index.html, gallery:http://matplotlib.org/gallery.html

The solution to Chinese disorder

Pay attention to the Chinese solution when drawing , stay .py Add the following to the header of the document :

  1. # -*- coding: utf-8 -*-
  2. from pylab import *
  3. mpl.rcParams[‘font.sans-serif’] = [‘SimHei’] # Specify default font
  4. mpl.rcParams[‘axes.unicode_minus’] = False # Resolve save image is negative ’-‘ Questions displayed as squares

I refer to this blog to install python matplotlib The required software is put on Baidu network disk , Sure Come here . Thank you for your selfless sharing !!

Drawing script .py To .exe

If you want to Python The script is published as detached Python Executable programs running on the platform , Like a single one exe file .

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

Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/150606.html Link to the original text :https://javaforall.cn


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved