我正在尝试运行这个示例程序 - http://pysnmp.sourceforge.net/examples/1.x/snmpbulk.html
我在 Mac OS X 上,我通过以下方式安装了 pysnmp -
$ sudo /usr/local/bin/pip install pysnmp
现在,当我运行程序时,我得到-
Traceback (most recent call last):
File "pysnmptest.py", line 2, in <module>
from pysnmp import msession
ImportError: cannot import name msession
更新:
好像 pysnmp 4.x 没有 msession,所以我尝试了 http://pysnmp.sourceforge.net/examples/4.x/v3arch/index.html
现在我得到 -
Traceback (most recent call last):
File "pysnmptest.py", line 2, in <module>
from pysnmp.entity.rfc3413.oneliner import cmdgen
File "/Library/Python/2.6/site-packages/pysnmp/entity/rfc3413/oneliner/cmdgen.py", line 2, in <module>
from pysnmp.entity import engine, config
File "/Library/Python/2.6/site-packages/pysnmp/entity/engine.py", line 2, in <module>
from pysnmp.proto.rfc3412 import MsgAndPduDispatcher
File "/Library/Python/2.6/site-packages/pysnmp/proto/rfc3412.py", line 3, in <module>
from pysnmp.smi import builder, instrum
File "/Library/Python/2.6/site-packages/pysnmp/smi/builder.py", line 4, in <module>
from pysnmp.smi import error
File "/Library/Python/2.6/site-packages/pysnmp/smi/error.py", line 1, in <module>
from pyasn1.error import PyAsn1Error
ImportError: No module named pyasn1.error
该网页还表示他们依赖于第三方库 -
最新的 PySNMP 版本(4.x 和更高版本)取决于以下内容:
用于处理 ASN.1 对象的 Python ASN.1 库 Python
Cryptography Toolkit 用于 SNMP 消息身份验证和加密
如何安装它们?直接从网页的压缩包安装会更好吗?