概述
由于前公司运维升级了python版本,导致semanage 命令无法使用。
[root@localhost ~]# semanage port -l
Traceback (most recent call last):
File "/usr/sbin/semanage", line 32, in <module>
import seobject
File "/usr/lib64/python2.7/site-packages/seobject/__init__.py", line 34, in <module>
from semanage import *
File "/usr/lib64/python2.7/site-packages/semanage.py", line 26, in <module>
_semanage = swig_import_helper()
File "/usr/lib64/python2.7/site-packages/semanage.py", line 22, in swig_import_helper
_mod = imp.load_module('_semanage', fp, pathname, description)
ImportError: /usr/lib64/python2.7/site-packages/_semanage.so: cannot open shared object file: No such file or directory
解决办法
[root@localhost ~]# rpm -q libsemanage-python
[root@localhost ~]# rpm -e libsemanage-python --nodeps
[root@localhost ~]# rpm -ivh libsemanage-python-2.5-14.el7.aarch64.rpm --nodeps