简体   繁体   English

ImportError:无法导入名称asn1

[英]ImportError: cannot import name asn1

i have installed pysnmp on centos using easy_install, however when i import asn1 it does not work 我已经使用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']
>>>

i am trying to run this example http://pysnmp.sourceforge.net/examples/2.x/snmpagent.html 我正在尝试运行此示例http://pysnmp.sourceforge.net/examples/2.x/snmpagent.html

my goal is to read snmp traps sent by other devices and process them on the server. 我的目标是读取其他设备发送的snmp陷阱并在服务器上处理它们。

You're trying to run an example for 2.x with version 4.x of the package. 您正在尝试使用2.x版本的软件包运行示例。 Find a 4.x example instead. 而是查找4.x示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM