Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>
Recently, when using Matplotlib in the process of using pychar in Linux, we can’t draw a picture, and always prompt an error
/usr/bin/python3.5 /home/leo/PycharmProjects/untitled1/Euler.py
Traceback (most recent call last):
File "/home/leo/PycharmProjects/untitled1/Euler.py", line 5, in <module>
import matplotlib.pyplot as plt
File "/usr/local/lib/python3.5/dist-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup
[backend_name], 0)
File "/home/leo/pycharm-2017.3.4/helpers/pycharm_matplotlib_backend/backend_interagg.py", line 17, in <module>
verbose = matplotlib.verbose
AttributeError: module 'matplotlib' has no attribute 'verbose'
According to the file prompted with error, enter the file prompted in the last line and enter the file
from matplotlib.backend_bases import FigureManagerBase, ShowBase
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
HOST = 'localhost'
PORT = os.getenv("PYCHARM_MATPLOTLIB_PORT")
PORT = int(PORT) if PORT is not None else None
PORT = PORT if PORT != -1 else None
index = int(os.getenv("PYCHARM_MATPLOTLIB_INDEX", 0))
rcParams = matplotlib.rcParams
verbose = matplotlib.verbose
The error is in verb = Matplotlib. Verb
Because in Python 3, it’s verb in Matplotlib
!!!!!!!!!! Note: capital V
Change it over and run it. The problem is solved perfectly