1.NameError: name ‘SnmpEngine’ is not defined
pysnmp高版本的api路径有改动,from pysnmp.hlapi import * 无法引入需要的模块。解决方案,使用低版本pysnmp(4.4.12)
pip uninstall pysnmp pip install pysnmp==4.4.12
2.ModuleNotFoundError: No module named ‘pyasn1.compat.octets’
pyasn1版本过高导致的问题。解决方案,使用低版本(0.4.8)
pip uninstall pyasn1 pip install pyasn1==0.4.8
参考资料:
Cannot find getCmd in pysnmp.hlapi
SNMP Library for Python(7.1.15)
pysnmp : AttributeError: ‘module’ object has no attribute ‘NotificationOriginator’