やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

ImportError: Gtk3 backend requires pygobject to be installed.

matplotlibのグラフ描画のためにlibgtk-3-devをインストールするもエラー。

matplotlib

import matplotlib as mpl
#mpl.use('tkagg')#import matplotlib.pyplot`よりも先に評価する
mpl.use('gtk3agg')
from matplotlib import pylab as plt

...

plt.plot(s.Wave[0:100])
plt.show()
$ python play.py 
Traceback (most recent call last):
  File "/.../game/lib/python3.6/site-packages/matplotlib/backends/backend_gtk3.py", line 10, in <module>
    import gi
ModuleNotFoundError: No module named 'gi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "play.py", line 10, in <module>
    from matplotlib import pylab as plt
  File "/.../game/lib/python3.6/site-packages/matplotlib/pylab.py", line 257, in <module>
    from matplotlib import cbook, mlab, pyplot as plt
  File "/.../game/lib/python3.6/site-packages/matplotlib/pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/.../game/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/.../game/lib/python3.6/site-packages/matplotlib/backends/backend_gtk3agg.py", line 11, in <module>
    from . import backend_gtk3
  File "/.../game/lib/python3.6/site-packages/matplotlib/backends/backend_gtk3.py", line 12, in <module>
    raise ImportError("Gtk3 backend requires pygobject to be installed.")
ImportError: Gtk3 backend requires pygobject to be installed.

pygobject

https://pygobject.readthedocs.io/en/latest/

$ pip install pygobject
Collecting pygobject
  Could not find a version that satisfies the requirement pygobject (from versions: )
No matching distribution found for pygobject

Python3.6.1にインストールできるpygobjectは存在しない。

3.4までらしい。

https://stackoverflow.com/questions/43529675/install-pygtk-for-python-3-6-1-on-windows-10

所感

エラーばかりで嫌になってきた。