gpt4 book ai didi

python - 用于 python 3 的 Centos 7 和 netsnmp

转载 作者:行者123 更新时间:2023-12-04 19:40:53 26 4
gpt4 key购买 nike

我在 centos 7 上安装了 python3,因为我应该开始将我的脚本从 python 2 移动到 3。

yum install python3

# rpm -qa |grep python3
python3-libs-3.6.8-13.el7.x86_64
python3-setuptools-39.2.0-10.el7.noarch
python3-pip-9.0.3-7.el7_7.noarch
python3-3.6.8-13.el7.x86_64
我有一个导入 netsnmp 并使用它的脚本。在 python 2 下工作正常,但在 python 3 下不行。
# rpm -qa |grep python |grep -i snmp
net-snmp-python-5.7.2-48.el7_8.1.x86_64
在 python3 下我得到这个错误:
Traceback (most recent call last):
File "up.py", line 52, in <module>
oid = netsnmp.Varbind('.1.3.6.1.2.1.1.5.0')
AttributeError: module 'netsnmp' has no attribute 'Varbind'
有没有办法让 netsnmp 在 centos 7 下与 python 3 一起工作,而无需大惊小怪且不会破坏任何东西?

最佳答案

赶紧跑。

yum install python2 -y
然后
yum install python36 -y
它应该可以工作,因为它覆盖或更新了所需的依赖项。

关于python - 用于 python 3 的 Centos 7 和 netsnmp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63349360/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com