尝试使用from gi.repository import glib
在python 3中导入glib时,我收到错误消息:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2135, 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 "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/gi/importer.py", line 53, in find_module
'introspection typelib not found' % namespace)
ImportError: cannot import name glib, introspection typelib not found
我在Ubuntu 14.04上使用apt-get安装了所有python glib / dev软件包。试图在python 2中导入模块说模块不存在。
我该如何解决这个问题?
答案 0 :(得分:3)
require
正确大写的对我有用:
GLib