gpt4 book ai didi

python - 没有名为 _backend_gdk 的模块

转载 作者:太空宇宙 更新时间:2023-11-04 06:42:35 26 4
gpt4 key购买 nike

我在 Windows 机器上使用带有 python 2.7 和 matplotlib 的 Spyder。

我正在尝试运行我的脚本,但出现以下错误:

runfile('C:/Python27/Scripts/python-serial-plot.py', wdir=r'C:/Python27/Scripts')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 601, in runfile
execfile(filename, namespace)
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 66, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Python27/Scripts/python-serial-plot.py", line 8, in <module>
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
File "C:\Python27\lib\site-packages\matplotlib\backends\backend_gtkagg.py", line 14, in <module>
from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
File "C:\Python27\lib\site-packages\matplotlib\backends\backend_gtk.py", line 36, in <module>
from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
File "C:\Python27\lib\site-packages\matplotlib\backends\backend_gdk.py", line 33, in <module>
from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
ImportError: No module named _backend_gdk

我去了后端存储的目录,看不到_backend_gdk

我该如何解决这个问题?

最佳答案

您需要更改图形后端以修复此错误。在 Spyder 中你需要去

工具 > 首选项 > IPython 控制台 > 图形 > 图形后端

并在那里选择 InlineAutomatic

关于python - 没有名为 _backend_gdk 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28341193/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com