简体   繁体   English

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

[英]Python3 centos/amazon AMI - installing net-snmp / easysnmp - gcc errors

I'm getting the below error when installing via pip3 using python and the AWS AMI image (which is loosely based on REHL/Centos) 使用python和AWS AMI映像(大致基于REHL / Centos)通过pip3安装时出现以下错误

this looks like dependencies to me, but I've searched to the ends of Google and I look to have installed everything needed. 这对我来说似乎是依赖性,但是我已经搜索到Google的末尾,并且我已经安装了所需的一切。

Can anyone see if I am missing a dependency? 谁能看到我是否缺少依赖项?

Dependencies install thus far as per below:- 到目前为止,依存关系的安装如下:

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

this is the output installing easysnmp 这是安装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/]$

and when I install net-snmp 当我安装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/

Have you installed net-snmp-devel? 您安装了net-snmp-devel吗? According to Amazon packages, this isn't installed by default: 根据Amazon软件包,默认情况下未安装:

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

You need to install Python-dev depends on your Python version for this error: 您需要根据错误的Python版本安装Python-dev

error: command 'gcc' failed with exit status 1

So do as the following: 因此,请执行以下操作:

  • If your Python version is 3.6: 如果您的Python版本是3.6:

    sudo apt-get install python3.6-dev

  • If your Python version is 3.5: 如果您的Python版本是3.5:

    sudo apt-get install python3.5-dev

  • If your Python version is 2.7: 如果您的Python版本是2.7:

    sudo apt-get install python2.7-dev

... ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM