matplotlib安装问题

画图时出现错误:

/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_gtk3agg.py:18: 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. "
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_gtk3agg.py", line 69, in on_draw_event
    buf, cairo.FORMAT_ARGB32, width, height)
NotImplementedError: Surface.create_for_data: Not Implemented yet.
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_gtk3agg.py", line 69, in on_draw_event
    buf, cairo.FORMAT_ARGB32, width, height)
NotImplementedError: Surface.create_for_data: Not Implemented yet.
/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_gtk3.py:215: Warning: Source ID 7 was not found when attempting to remove it
  GLib.source_remove(self._idle_event_id)
解决方法:

解决方案:
正如你所看到的,所以给出的建议是:cairocffi很简单的安装指南。如果满足依赖关系*那么简单:*逻辑应该的依赖关系:

原文:

As you can see:

"The Gtk3Agg backend is known to not work on Python 3.x with pycairo."

And so the suggestion presented is:

Try installing cairocffi.

The installation guide for cairocffi is pretty straight-forward. If the dependencies* are met it is as simple as:

pip install cairocffi

*The dependencies for Py3 should logically be:

sudo apt-get install python3-dev
sudo apt-get install libffi-dev

其中,在安装libffi-dev要求安装libffi6的固定版本,即出现一下错误:

libffi-dev : Depends: libffi6 (= 3.1~rc1+r3.0.13-12) but 3.1~rc1+r3.0.13-12ubuntu0.1 is to be installed

通过如下方法安装指定版本:

sudo apt-cache policy libffi6

sudfo apt-get install libffi6=3.1~rc1+r3.0.13-12

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值