0

我已经使用easy_install在centos上安装了pysnmp,但是当我导入asn1时它不起作用

[root@server ~]# python
Python 2.4.3 (#1, Jun 18 2012, 08:55:23)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pysnmp import asn1
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: cannot import name asn1
>>> import sys
>>> print sys.path
['', '/usr/lib/python2.4/site-packages', '/usr/lib/python2.4/site-packages/pysnmp-4.2.2-py2.4.egg', '/usr/lib/python2.4/site-packages/pycrypto-2.6-py2.4-linux-x86_64.egg', '/usr/lib/python2.4/site-packages/pyasn1-0.1.3-py2.4.egg', '/usr/lib64/python24.zip', '/usr/lib64/python2.4', '/usr/lib64/python2.4/plat-linux2', '/usr/lib64/python2.4/lib-tk', '/usr/lib64/python2.4/lib-dynload', '/usr/lib64/python2.4/site-packages', '/usr/lib64/python2.4/site-packages/gtk-2.0', '/usr/lib/python2.4/site-packages']
>>>

我正在尝试运行此示例http://pysnmp.sourceforge.net/examples/2.x/snmpagent.html

我的目标是读取其他设备发送的 snmp 陷阱并在服务器上处理它们。

4

1 回答 1

0

您正在尝试使用 4.x 版本的软件包运行 2.x 示例。改为查找 4.x 示例。

于 2012-07-07T16:23:36.373 回答