本文介绍了ImportError:没有名为gi.repository的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Ubuntu 10.04上启动python脚本:
I'm trying to launch python script on Ubuntu 10.04:
from gi.repository import Nautilus, GObject
它不起作用:
Traceback (most recent call last):
File "script.py", line 1, in <module>
from gi.repository import Nautilus, GObject
ImportError: No module named gi.repository
我安装了python-gobject-dev
,python-gobject
,python-nautilus
,但没有帮助.有人遇到这个问题吗?
I installed python-gobject-dev
, python-gobject
, python-nautilus
, but it didn't help.Has anyone had this problem?
推荐答案
尝试通过安装 PyGObject :
# With Apt on Ubuntu:
$ sudo apt install python3-gi
# With Yum on CentOS / RHEL:
$ sudo yum install python36-gobject.x86_64
# Or directly with Pip:
$ pip3 install PyGObject
这篇关于ImportError:没有名为gi.repository的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!