centos7上 python安装netsnmp模块
snmp-cmds模块通过SNMP与目标设备进行通信,此模块适用于windows,此模块是基于系统已安装了net-snmp环境
easysnmp模块通过SNMP与谬表设备进行通信,此模块用于linux,此模块基于系统已安装了net-snmp环境
二、snmp-cmds模块安装
2.1 在Windows平台
#1.系统环境安装net-snmp软件
a.下载链接: https://pan.baidu.com/s/1sq4mjIMfFgG2YxTMLxVF0A 提取码: a7j5
b.安装完成,打开cmd命令框,输入snmpwalk,无报错,有回显,即安装正常
#2.使用pip工具安装snmp-cmds模块
pip3 install snmp-cmds
2.2 在Centos 7平台
#1.系统环境安装net-snmp软件
a.yum install python-devel
b.安装setuptools
wget https://files.pythonhosted.org/packages/25/5d/cc55d39ac39383dd6e04ae80501b9af3cc455be64740ad68a4e12ec81b00/setuptools-0.6c11-py2.7.egg
c.安装net-snmp-5.7.3软件
wget https://sourceforge.net/projects/net-snmp/files/net-snmp/5.7.3/net-snmp-5.7.3.tar.gz --no-check-certificate
d.提升setuptools为可执行文件
chmod +x setuptools-0.6c11-py2.7.egg
e. ./setuptools-0.6c11-py2.7.egg
f. tar -zxvf net-snmp-5.7.3.tar.gz
g. cd net-snmp-5.7.3
h. ./configure --with-python-modules #选择版本时,输入2,其余直接回车
i. make (时间较长)
j. make install
k. echo "/usr/local/lib" >> /etc/ld.so.conf
l. ldconfig
m. 验证,是否有snmpwalk命令
#2.使用pip工具安装snmp-cmds模块
pip3 install easysnmp
ps:easysnmp官方文档地址:https://easysnmp.readthedocs.io/en/latest/
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了