>>> import matplotlib.pyplot as plt
>>> fig = plt.figure()
>>> ax1 = fig.add_subplot(2,2,1)
>>> plt.show()
TypeError: Couldn't find foreign struct converter for 'cairo.Context'
Was ist das ... Ich dachte daran, eine Grafik zu zeichnen und zu spielen ...
Verteilung: 4.4.5-1-ARCH Python:Python 3.5.1
Der Artikel Python matplotlib Cairo error enthielt ein ähnliches Beispiel, sodass ich es leicht lösen konnte, indem ich Sole folgte. ..
#python3 im offiziellen Arch-Repository-Python statt Pyqt5-Es ist wie pyqt5.
sudo pacman -S python-pyqt5
--Überprüfen Sie das Verzeichnis, um matplotlibrc neu zu schreiben.
>>>import matplotlib
>>>matplotlib.matplotlib_fname()
'/usr/lib/python3.5/site-packages/matplotlib/mpl-data/matplotlibrc'
matplotlibrc
# The default backend; one of GTK GTKAgg GTKCairo GTK3Agg GTK3Cairo
# CocoaAgg MacOSX Qt4Agg Qt5Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVG
# Template.
# You can also deploy your own backend outside of matplotlib by
# referring to the module name (which must be in the PYTHONPATH) as
# 'module://my_backend'.
backend : qt5agg #Ich habe hier umgeschrieben. Ursprünglich Backend: gtk3agg
--Und ...
erledigt. Ich habs gemacht.
Recommended Posts