ImportError:无法导入名称asn1

时间:2012-07-07 15:30:32

标签: python python-2.4

我使用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陷阱并在服务器上处理它们。

1 个答案:

答案 0 :(得分:0)

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