Raspberry Pi Python SNMP 库错误
Raspberry Pi Python SNMP library error
我在 SNMP 陷阱消息接收器中开发了 raspberryi pi。
在树莓派中执行此操作时我无法使用库:PYSNMP
在终端的 python 文件中使用此代码
我运行这个代码
Python Receive SNMP Trap Sample
此终端错误:
pi@raspberrypi:~/snmp $ python snmp_test.py
Traceback (most recent call last):
File "snmp_test.py", line 1, in <module>
from pysnmp.entity import engine, config
File "/home/pi/snmp/pysnmp/entity/engine.py", line 11, in <module>
from pysnmp.proto.rfc3412 import MsgAndPduDispatcher
File "/home/pi/snmp/pysnmp/proto/rfc3412.py", line 11, in <module>
from pysnmp.proto.api import verdec # XXX
File "/home/pi/snmp/pysnmp/proto/api/__init__.py", line 7, in <module>
from pysnmp.proto.api import v1, v2c, verdec
File "/home/pi/snmp/pysnmp/proto/api/v2c.py", line 7, in <module>
from pysnmp.proto import rfc1901, rfc1902, rfc1905
File "/home/pi/snmp/pysnmp/proto/rfc1901.py", line 8, in <module>
from pysnmp.proto import rfc1905
File "/home/pi/snmp/pysnmp/proto/rfc1905.py", line 8, in <module>
from pysnmp.proto import rfc1902
File "/home/pi/snmp/pysnmp/proto/rfc1902.py", line 563, in <module>
class Bits(OctetString):
File "/home/pi/snmp/pysnmp/proto/rfc1902.py", line 614, in Bits
def __init__(self, value=univ.noValue, tagSet=None, subtypeSpec=None,
AttributeError: 'module' object has no attribute 'noValue'
我是按照@barny的建议安装的。问题已解决:
sudo pip install pysnmp-apps
可能是包依赖性问题。你需要的是安装pysnmp:
pip install pysnmp
什么也将安装所需的依赖项。从回溯看来,与预期的 pysnmp 版本相比,您有一个较旧的 pyasn1(这是依赖项)。
我在 SNMP 陷阱消息接收器中开发了 raspberryi pi。
在树莓派中执行此操作时我无法使用库:PYSNMP
在终端的 python 文件中使用此代码 我运行这个代码
Python Receive SNMP Trap Sample
此终端错误:
pi@raspberrypi:~/snmp $ python snmp_test.py
Traceback (most recent call last):
File "snmp_test.py", line 1, in <module>
from pysnmp.entity import engine, config
File "/home/pi/snmp/pysnmp/entity/engine.py", line 11, in <module>
from pysnmp.proto.rfc3412 import MsgAndPduDispatcher
File "/home/pi/snmp/pysnmp/proto/rfc3412.py", line 11, in <module>
from pysnmp.proto.api import verdec # XXX
File "/home/pi/snmp/pysnmp/proto/api/__init__.py", line 7, in <module>
from pysnmp.proto.api import v1, v2c, verdec
File "/home/pi/snmp/pysnmp/proto/api/v2c.py", line 7, in <module>
from pysnmp.proto import rfc1901, rfc1902, rfc1905
File "/home/pi/snmp/pysnmp/proto/rfc1901.py", line 8, in <module>
from pysnmp.proto import rfc1905
File "/home/pi/snmp/pysnmp/proto/rfc1905.py", line 8, in <module>
from pysnmp.proto import rfc1902
File "/home/pi/snmp/pysnmp/proto/rfc1902.py", line 563, in <module>
class Bits(OctetString):
File "/home/pi/snmp/pysnmp/proto/rfc1902.py", line 614, in Bits
def __init__(self, value=univ.noValue, tagSet=None, subtypeSpec=None,
AttributeError: 'module' object has no attribute 'noValue'
我是按照@barny的建议安装的。问题已解决:
sudo pip install pysnmp-apps
可能是包依赖性问题。你需要的是安装pysnmp:
pip install pysnmp
什么也将安装所需的依赖项。从回溯看来,与预期的 pysnmp 版本相比,您有一个较旧的 pyasn1(这是依赖项)。