当尝试使用 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 中导入模块时提示该模块不存在。
我该如何解决这个问题?
最佳答案
它适用于 GLib
正确大写:
from gi.repository import GLib
关于python - 导入 Glib 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31151785/