Sto iniziando a ottenere alcune informazioni sul disegno interattivo con python e matplotlib usando pyGTK +. Pertanto ho dato un'occhiata allo example given at the matplotlib website.ImportError: nessun modulo denominato _backend_gdk
Questa è una breve exerpt del Codice:
#!/usr/bin/env python
"""
Example of embedding matplotlib in an application and interacting with
a treeview to store data. Double click on an entry to update plot
data
"""
import pygtk
pygtk.require('2.0')
import gtk
from gtk import gdk
import matplotlib
matplotlib.use('GTKAgg') # or 'GTK'
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
from numpy.random import random
from matplotlib.figure import Figure
Ones provo a eseguire questo script nel terminale ottengo il seguente errore:
Traceback (most recent call last):
File "gtk_spreadsheet.py", line 15, in <module>
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_gtk.py", line 33, in <module>
from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-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
ho python 2.7 e PyGTK 2.24 installato.
Qualcuno può capire dove si trova l'errore? Penso che potrebbe essere collegato ad alcuni problemi di collegamento?
Come è stato installato matplotlib? '_backend_gdk' è un'estensione c-python che deve essere compilata. – tacaswell
puoi compilarlo separatamente da matplotlib se matplotlib è già compilato? Costruisco matplotlib dal sorgente tramite il terminale. – Gjan
probabilmente, ma collegarlo correttamente richiederà la replica della magia profonda che setup.py fa. – tacaswell