背景:在CentOS7 系统下,python2版本是没有gi模块的,所以就需要我们自行安装;
判断python是否有gi模块:
终端输入: python
在python终端窗口: import gi
回车确认;
执行正常没有错误说明python2 已经安装了gi模块;若返回异常则需要安装;
gi安装:
第一步: sudo yum install python-gobject #通常会提示已经安装最新版本了,直接忽略就OK
第二步: sudo yum install python-firewall
上述步骤 执行完成后,再次确认gi模块导入正常;
初次分享,希望可以帮助有需要的童鞋。