在CentOS 6.5上无法在Python中导入netsnmp

2 投票
1 回答
4883 浏览
提问于 2025-04-18 04:02

我正在尝试在Python中使用netsnmp,但在按照所有与netsnmp相关的建议后,还是无法导入。为了安装netsnmp,我使用了以下命令:

yum install net-snmp net-snmp-utils
easy_install ipython

snmpd服务正在运行。 但是它仍然抛出这个错误:

ImportError: No module named netsnmp

我使用的是CentOS 6.5和Python版本2.6.6。 如果安装不正确或者缺少其他配置,请帮忙指点一下。

1 个回答

2

在Python中导入netsnmp只需要安装 net-snmp-python,可以把 net-snmpnet-snmp-utils 删除掉。

所以只需要

yum install net-snmp-python

就可以在CentOS 6.5上导入netsnmp库到Python中。

yum install net-snmp net-snmp-utils

这样就能在Linux终端进行SNMP查询了。这两个可以独立工作。

撰写回答