1.下载setuptools-0.6c11-py2.7.egg(地址https://pypi.python.org/pypi/setuptools/0.6c11#downloads)

#添加执行权限chmod +x setuptools-0.6c11-py2.7.egg#执行脚本./setuptools-0.6c11-py2.7.egg

2.安装python-devel

yum install -y python-devel

3.下载net-snmp-5.7.3.tar.gz(地址:http://www.net-snmp.org/download.html)

#解压tar -zxvf net-snmp-5.7.3.tar.gz#进入文件夹cd net-snmp-5.7.3#编译文件./configure --prefix=/usr/local/netsnmp --with-python-modulesmake && make install

4.在/etc/profile最后面加入

export PATH="/usr/local/netsnmp/bin:$PATH"

5.将库文件目录的路径加入到/etc/ld.so.conf文件

echo "/usr/local/netsnmp/lib" >> /etc/ld.so.confldconfig

6.编译安装python模块

#进入python文件夹cd pythonpython setup.py buildpython setup.py test#可选,测试可能失败,失败后重新执行上一步,不再进行测试python setup.py install