centos7: from gi.repository import GObject ModuleNotFoundError: No module named 'gi'

created at 03-31-2022 views: 91

problem

centos7 no longer uses iptables to operate, but uses firewalld command to open ports

But recently, I found that I always reported an error:

solution

Modify the python point in the /usr/bin/firewall-cmd directory. Since the firewall command only supports python2, we need to change it to the local environment of python2, because I upgraded the python environment of centos7 before. For the sake of python3.6. As a result, the command does not work properly now.

I can execute vi /usr/bin/firewall-cmd here to modify the python point of the first line,

Modified from the previous

#!/usr/bin/python

to:

#!/usr/bin/python2

There is one more place: /usr/sbin/firewalld, which is also the python pointer to modify the first line.

created at:03-31-2022
edited at: 05-29-2022: