使用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/
答案 0 :(得分:0)
你安装了net-snmp-devel吗?根据亚马逊软件包,默认情况下不会安装:
答案 1 :(得分:0)
此错误需要您安装Python-dev
取决于您的Python版本:
error: command 'gcc' failed with exit status 1
请执行以下操作:
如果您的Python版本是3.6:
sudo apt-get install python3.6-dev
如果您的Python版本是3.5:
sudo apt-get install python3.5-dev
如果您的Python版本是2.7:
sudo apt-get install python2.7-dev
...