Anaconda3 use matplotlib drawing error solution to the problem

In the drawing Anaconda3 used matplotlib given:
ModuleNotFoundError: No Module1 the named 'the PyQt4'

Tried several online methods do not work, and finally on http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt4 download and Python versions correspond .whl PyQt4 file, and then use pip install command.

Now and then executing the program not reporting the above error, the command execution time and reported to plt.figure (): TypeError: 'figure' is an unkown keyword argument

At this time, in the source code needs to be increased in two,

# 新增语句
import matplotlib
matplotlib.use('TkAgg')
# 原语句
import matplotlib.pyplot as plt

At this point, the code is completely executed properly, can properly display the picture.

Guess you like

Origin blog.51cto.com/4292565/2451307