Saya pengguna baru matplotlib, platform saya adalah Ubuntu 10.04 Python 2.6.5
Ini kode saya
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.plot([1,2,3])
Kesalahannya adalah:
/usr/local/lib/python2.6/dist-packages/matplotlib/backends/__init__.py:41: UserWarning:
Your currently selected backend, 'agg' does not support show().
Please select a GUI backend in your matplotlibrc file ('/usr/local/lib/python2.6/dist-packages/matplotlib/mpl-data/matplotlibrc')
or with matplotlib.use()
(backend, matplotlib.matplotlib_fname()))
- Saya menginstal pustaka Anti-Grain Geometry
apt-get install libagg
tetapi tidak berfungsi. - Saya mencoba menggunakan argumen backend lain seperti 'GTK' dan 'TkAgg'.
- Saya menginstal
python-gtk2-dev
paket, tetapi kesalahan masih ada di bawah. - Adakah yang bisa memberi tahu saya argumen backend yang dapat dieksekusi dan pustaka ketergantungannya?
Inilah kesalahannya:
>>> matplotlib.use('GTK')
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/matplotlib/pyplot.py", line 95, in <module>
new_figure_manager, draw_if_interactive, show = pylab_setup()
File "/usr/local/lib/python2.6/dist-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
globals(),locals(),[backend_name])
File "/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_gtk.py", line 28, in <module>
from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
File "/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_gdk.py", line 29, in <module>
from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
ImportError: No module named _backend_gdk