1

私はいくつかの輸入品を持っています:

gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk, GdkPixBuf

エラー (おそらく 2) が発生します。

WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 2158, in _find_spec
AttributeError: 'DynamicImporter' object has no attribute 'find_spec'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "camerapython.py", line 10, in <module>
    from gi.repository import Gdk, GdkPixBuf
  File "/usr/lib/python3/dist-packages/gi/importer.py", line 53, in find_module
    'introspection typelib not found' % namespace)
ImportError: cannot import name GdkPixBuf, introspection typelib not found

私が気付いたのは、gi の importer.py で、repository.enumerate_versions(namespace) が GdkPixBuf に対して [] を返す (したがってエラーが発生する) ことです。

他のインポートは何かを返します:

Gtk : ['3.0']
GObject : ['2.0', '2.0']
GLib : ['2.0', '2.0']
Atk : ['1.0', '1.0']
Gdk : ['3.0', '3.0']
cairo : ['1.0', '1.0']

必要に応じて、私のディストリビューションは Raspbian (Raspberry Pi 3) です。

4

1 に答える 1

2

Pixbuf を間違ってインポートしています。

from gi.repository import Gdk, GdkPixbuf
于 2018-03-22T00:14:16.680 に答える