发表于 2019-4-17 18:01:06

centos安装python netsnmp扩展

  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-modules
make && 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.conf
ldconfig
  6.编译安装python模块

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


页: [1]
查看完整版本: centos安装python netsnmp扩展