当我尝试运行python脚本时,出现“ImportError:No module named netsnmp”消息。有些人可以帮我吗?我没有任何Python脚本经验。ImportError:没有名为netsnmp的模块
这是Icinga的插件脚本,我想使用。但我无法让它在我的Icinga服务器上运行。 Icinga服务器是Red Hat Linux,并在我的时间之前进行了配置。任何帮助将非常感激。以下是错误的屏幕截图。
[[email protected] ~]$ /usr/bin/check_snmp_idrac.py -h
Traceback (most recent call last):
File "/usr/bin/check_snmp_idrac.py", line 5, in <module>
pkg_resources.run_script('health-monitoring-plugins==0.0.5', 'check_snmp_idrac.py')
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 461, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1194, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/lib/python2.6/site-packages/health_monitoring_plugins-0.0.5-py2.6.egg/EGG-INFO/scripts/check_snmp_idrac.py", line 20, in <module>
import netsnmp
ImportError: No module named netsnmp
[[email protected] ~]$
在此先感谢您的帮助
感谢您的帮助。我尝试安装netsnmp-py3-0.3 python软件包,但收到错误消息。关于下面的错误的任何想法?谢谢
[[email protected] netsnmp-py3-0.3]# python setup.py install
running install
running bdist_egg
running egg_info
writing netsnmp_py.egg-info/PKG-INFO
writing top-level names to netsnmp_py.egg-info/top_level.txt
writing dependency_links to netsnmp_py.egg-info/dependency_links.txt
reading manifest file 'netsnmp_py.egg-info/SOURCES.txt'
writing manifest file 'netsnmp_py.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building 'netsnmp._api' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURC E -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC - fwrapv -fPIC -I./netsnmp -I/usr/include/python2.6 -c netsnmp/session.c -o build/temp.linux-x86_64-2.6/netsnmp/session.o
netsnmp/session.c:1:20: error: Python.h: No such file or directory
In file included from netsnmp/session.c:2:
./netsnmp/_api.h:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./netsnmp/_api.h:19: error: expected ‘)’ before ‘*’ token
./netsnmp/_api.h:20: error: expected ‘)’ before ‘*’ token
./netsnmp/_api.h:21: error: expected ‘)’ before ‘*’ token
./netsnmp/_api.h:22: error: expected ‘)’ before ‘*’ token
./netsnmp/_api.h:27: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./netsnmp/_api.h:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./netsnmp/_api.h:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./netsnmp/_api.h:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./netsnmp/_api.h:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
netsnmp/session.c:5:40: error: net-snmp/net-snmp-features.h: No such file or directory
netsnmp/session.c:8: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
netsnmp/session.c:60: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
error: command 'gcc' failed with exit status 1
[[email protected] netsnmp-py3-0.3]#
您是否安装该模块? – Josh