树莓派使用matplotlib出错

本文介绍了解决Python3.x中matplotlib使用Gtk3Agg后端出现警告及错误的方法。建议安装cairocffi替代pycairo,并推荐使用Pdf后端来规避问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

** (test_center.py:17547): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
/home/pi/.local/lib/python3.5/site-packages/matplotlib/backends/backend_gtk3agg.py:16: UserWarning: The Gtk3Agg backend is known to not work on Python 3.x with pycairo. Try installing cairocffi.
  "The Gtk3Agg backend is known to not work on Python 3.x with pycairo. "

(test_center.py:17547): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
追踪与中断点陷阱
 

在代码import matplotlib.pyplot as plt前添加:

import  matplotlib

matplotlib.use("Pdf")

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值