4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RaspberryPiでPython3とMatplotlib使ってリアルタイムグラフ描画

Last updated at Posted at 2018-08-18

はじめに

このサイト見て試してみたらすんなりは動かなかった。
【Matplotlib】リアルタイムグラフの速さ(更新間隔) | アルゴリズム雑記

試行錯誤

まず、こんなエラーメッセージがでた。

/usr/local/lib/python3.5/dist-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. "
TypeError: Couldn't find foreign struct converter for 'cairo.Context'

cairocffiって何なのかわからんけど、とりあえず入れてみた。

sudo pip3 install cairocffi

まだ、エラー出る。

TypeError: Couldn't find foreign struct converter for 'cairo.Context'

調べると、こんなんひっかかる。
TypeError: Couldn't find conversion for foreign struct 'cairo.Context' · Issue #221 · rbgirshick/py-faster-rcnn
ノート - FrstGt
Python で matplotlib を試そうとしたら 'cairo.Context' ってナニソレ - Qiita

環境によって対応策違うのかもしれないけど、
python3-gi-cairo入れたら良さそうだったので試した。

sudo apt-get install python3-gi-cairo

これで、実行できた。よかったよかった。

おわりに

どういう依存関係かよくわからんけど、とりあえず動いてよかった。

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?