Python3 centos/amazon AMI - 安装 net-snmp/easysnmp - gcc 错误

标签 python amazon-web-services gcc centos easysnmp

使用 python 和 AWS AMI 镜像(松散地基于 REHL/Centos)通过 pip3 安装时出现以下错误

这对我来说看起来像是依赖项,但我已经搜索到谷歌的尽头,我看起来已经安装了所有需要的东西。

谁能看到我是否缺少依赖项?

到目前为止,依赖项安装如下: -

sudo yum install python35.x86_64
sudo yum install gcc-c++ python35-devel.x86_64 cyrus-sasl-devel.x86_64
sudo yum install mysql mysql-devel mysql-lib
sudo yum install net-snmp-libs net-snmp-devel net-snmp-agent-libs
sudo yum install gcc python-devel

这是安装easysnmp的输出
  Running setup.py install for easysnmp ... error
    Complete output from command /usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9e4w4qtu/easysnmp/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-bgholydk-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.4
    creating build/lib.linux-x86_64-3.4/easysnmp
    copying easysnmp/helpers.py -> build/lib.linux-x86_64-3.4/easysnmp
    copying easysnmp/utils.py -> build/lib.linux-x86_64-3.4/easysnmp
    copying easysnmp/easy.py -> build/lib.linux-x86_64-3.4/easysnmp
    copying easysnmp/session.py -> build/lib.linux-x86_64-3.4/easysnmp
    copying easysnmp/variables.py -> build/lib.linux-x86_64-3.4/easysnmp
    copying easysnmp/compat.py -> build/lib.linux-x86_64-3.4/easysnmp
    copying easysnmp/exceptions.py -> build/lib.linux-x86_64-3.4/easysnmp
    copying easysnmp/__init__.py -> build/lib.linux-x86_64-3.4/easysnmp
    running build_ext
    building 'easysnmp.interface' extension
    creating build/temp.linux-x86_64-3.4
    creating build/temp.linux-x86_64-3.4/easysnmp
    gcc -pthread -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1 -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/usr/include/python3.4m -c easysnmp/interface.c -o build/temp.linux-x86_64-3.4/easysnmp/interface.o -Wno-unused-function
    easysnmp/interface.c: In function ‘netsnmp_create_session_tunneled’:
    easysnmp/interface.c:1843:17: error: ‘SnmpSession’ has no member named ‘transport_configuration’
         if (!session.transport_configuration)
                     ^
    easysnmp/interface.c:1846:16: error: ‘SnmpSession’ has no member named ‘transport_configuration’
             session.transport_configuration =
                    ^
    easysnmp/interface.c:1848:21: error: ‘SnmpSession’ has no member named ‘transport_configuration’
             if (!session.transport_configuration)
                         ^
    easysnmp/interface.c:1855:16: error: ‘SnmpSession’ has no member named ‘transport_configuration’
             session.transport_configuration->compare =
                    ^
    easysnmp/interface.c:1856:42: error: ‘netsnmp_transport_config_compare’ undeclared (first use in this function)
                 (netsnmp_container_compare*) netsnmp_transport_config_compare;
                                              ^
    easysnmp/interface.c:1856:42: note: each undeclared identifier is reported only once for each function it appears in
    easysnmp/interface.c:1860:33: error: ‘SnmpSession’ has no member named ‘transport_configuration’
             CONTAINER_INSERT(session.transport_configuration,
                                     ^
    easysnmp/interface.c:1861:26: warning: implicit declaration of function ‘netsnmp_transport_create_config’ [-Wimplicit-function-declaration]
                              netsnmp_transport_create_config("localCert",
                              ^
    easysnmp/interface.c:1862:58: warning: passing argument 2 of ‘CONTAINER_INSERT’ makes pointer from integer without a cast [enabled by default]
                                                              our_identity));
                                                              ^
    In file included from /usr/include/net-snmp/utilities.h:54:0,
                     from /usr/include/net-snmp/net-snmp-includes.h:74,
                     from easysnmp/interface.c:25:
    /usr/include/net-snmp/library/container.h:391:9: note: expected ‘const void *’ but argument is of type ‘int’
         int CONTAINER_INSERT(netsnmp_container* x, const void* k)
             ^
    easysnmp/interface.c:1865:33: error: ‘SnmpSession’ has no member named ‘transport_configuration’
             CONTAINER_INSERT(session.transport_configuration,
                                     ^
    easysnmp/interface.c:1867:58: warning: passing argument 2 of ‘CONTAINER_INSERT’ makes pointer from integer without a cast [enabled by default]
                                                              their_identity));
                                                              ^
    In file included from /usr/include/net-snmp/utilities.h:54:0,
                     from /usr/include/net-snmp/net-snmp-includes.h:74,
                     from easysnmp/interface.c:25:
    /usr/include/net-snmp/library/container.h:391:9: note: expected ‘const void *’ but argument is of type ‘int’
         int CONTAINER_INSERT(netsnmp_container* x, const void* k)
             ^
    easysnmp/interface.c:1870:33: error: ‘SnmpSession’ has no member named ‘transport_configuration’
             CONTAINER_INSERT(session.transport_configuration,
                                     ^
    easysnmp/interface.c:1872:58: warning: passing argument 2 of ‘CONTAINER_INSERT’ makes pointer from integer without a cast [enabled by default]
                                                              their_hostname));
                                                              ^
    In file included from /usr/include/net-snmp/utilities.h:54:0,
                     from /usr/include/net-snmp/net-snmp-includes.h:74,
                     from easysnmp/interface.c:25:
    /usr/include/net-snmp/library/container.h:391:9: note: expected ‘const void *’ but argument is of type ‘int’
         int CONTAINER_INSERT(netsnmp_container* x, const void* k)
             ^
    easysnmp/interface.c:1875:33: error: ‘SnmpSession’ has no member named ‘transport_configuration’
             CONTAINER_INSERT(session.transport_configuration,
                                     ^
    easysnmp/interface.c:1877:58: warning: passing argument 2 of ‘CONTAINER_INSERT’ makes pointer from integer without a cast [enabled by default]
                                                              trust_cert));
                                                              ^
    In file included from /usr/include/net-snmp/utilities.h:54:0,
                     from /usr/include/net-snmp/net-snmp-includes.h:74,
                     from easysnmp/interface.c:25:
    /usr/include/net-snmp/library/container.h:391:9: note: expected ‘const void *’ but argument is of type ‘int’
         int CONTAINER_INSERT(netsnmp_container* x, const void* k)
             ^
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9e4w4qtu/easysnmp/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-bgholydk-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-9e4w4qtu/easysnmp/
[ec2-user@ip-10/]$

当我安装 net-snmp
[ec2-user@ip-10/]$ pip3 install netsnmp-py
Collecting netsnmp-py
  Using cached netsnmp-py-0.4.tar.gz
Installing collected packages: netsnmp-py
  Running setup.py install for netsnmp-py ... error
    Complete output from command /usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zq9uoh2p/netsnmp-py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-owzi19wx-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.4
    creating build/lib.linux-x86_64-3.4/netsnmp
    copying netsnmp/__main__.py -> build/lib.linux-x86_64-3.4/netsnmp
    copying netsnmp/__init__.py -> build/lib.linux-x86_64-3.4/netsnmp
    copying netsnmp/_hex.py -> build/lib.linux-x86_64-3.4/netsnmp
    creating build/lib.linux-x86_64-3.4/netsnmp/_dev
    copying netsnmp/_dev/cisco.py -> build/lib.linux-x86_64-3.4/netsnmp/_dev
    copying netsnmp/_dev/technicolor.py -> build/lib.linux-x86_64-3.4/netsnmp/_dev
    copying netsnmp/_dev/__init__.py -> build/lib.linux-x86_64-3.4/netsnmp/_dev
    copying netsnmp/_dev/arris.py -> build/lib.linux-x86_64-3.4/netsnmp/_dev
    running build_ext
    building 'netsnmp._api' extension
    creating build/temp.linux-x86_64-3.4
    creating build/temp.linux-x86_64-3.4/netsnmp
    gcc -pthread -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1 -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/python3.4m -c netsnmp/session.c -o build/temp.linux-x86_64-3.4/netsnmp/session.o
    netsnmp/session.c:5:40: fatal error: net-snmp/net-snmp-features.h: No such file or directory
     #include <net-snmp/net-snmp-features.h>
                                            ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zq9uoh2p/netsnmp-py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-owzi19wx-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-zq9uoh2p/netsnmp-py/

最佳答案

你安装了net-snmp-devel吗?根据亚马逊包,默认情况下不安装:

https://aws.amazon.com/amazon-linux-ami/2016.03-packages/

关于Python3 centos/amazon AMI - 安装 net-snmp/easysnmp - gcc 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46529768/

相关文章:

python - 减少构建字典/字符串的嵌套 for 循环(分支树样式)

c++ - 将 CMake 编译器显式设置为 GCC 会导致无限循环

当 makefile 调用 GCC 时,C 程序不会在没有警告的情况下编译 - 否则可以工作

python - 为什么终止此子进程会引发 ProcessLookupError?

Python 3 : EOF when reading a line (Visual Studio Code)

amazon-web-services - Amazon EC2 - 通过特定端口访问应用程序。

amazon-web-services - AWS CloudWatch : EndpointConnectionError: Could not connect to the endpoint URL

python - Flask 应用程序在确认 Flask 安装后,elasticbeanstalk 中没有名为 Flask 的模块错误

c - 如何在 Linux 中编译静态库?

python - 在 Bokeh 中隐藏轴