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

发布了111 篇原创文章 · 获赞 74 · 访问量 32万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览