matplotlib安装问题

来源:互联网 发布:ant java 编辑:程序博客网 时间:2024/06/06 01:47

画图时出现错误:

/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-devsudo 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 libffi6sudfo apt-get install libffi6=3.1~rc1+r3.0.13-12

原创粉丝点击