Skip to main content
 首页 » 编程设计

python之无法在 centos 6.5 的 python 中导入 netsnmp

2024年11月01日8Leo_wl

我正在尝试在 python 中使用 netsnmp,但在遵循与 python 中的 netsnmp 相关的所有建议后,它无法导入。我使用以下命令安装了 netsnmp

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

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

ImportError: No module named netsnmp 

我使用的是 Cent os 6.5 和 Python 版本 2.6.6 如果安装不正确或缺少任何其他配置,请提供帮助。

请您参考如下方法:

要在 python 中导入 netsnmp,只需 net-snmp-python 即可,同时可以删除 net-snmp net-snmp-utils。 所以只是

yum install net-snmp-python 

将在 Cent os 6.5 上将 netsnmp 库导入 python

yum install net-snmp net-snmp-utils 

将从 Linux 终端启用 SNMP 查询。 两者都可以独立工作。