简体   繁体   English

错误:命令“gcc”以退出状态失败 - 在 docker centos 上安装 ibm_db 时

[英]error: command 'gcc' failed with exit status - while installing ibm_db on docker centos

I am trying to install ibm_db - python3.6 but not able to do pip install.我正在尝试安装 ibm_db - python3.6 但无法安装 pip。 On python 2.7 the installation is successful but on 3.6 its throwing gcc error在 python 2.7 上安装成功,但在 3.6 上它抛出 gcc 错误

Docker File Docker 文件

RUN yum -y install python3
RUN yum install -y python34-devel python-devel centos-release-scl gcc libssl-dev openssl yum install gcc openssl-devel bzip2-devel libffi libffi-devel
RUN yum install -y python gcc gcc-c++ libgcc libstdc++ gnupg wget make git
RUN python --version
RUN which python
RUN pip --version
RUN python3 --version
RUN which python3
RUN pip3 --version

RUN python3.6 -m pip install -r scripts/requirements.txt

Requirements.txt要求.txt

ibm_db==3.0.2
ibm-db-sa==0.3.5
SQLAlchemy==1.3.18

logs日志

08-Aug-2020 07:57:40        building 'ibm_db' extension
08-Aug-2020 07:57:40        creating build/temp.linux-x86_64-3.6
08-Aug-2020 07:57:40        gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Iclidriver/include -I/usr/include/python3.6m -c ibm_db.c -o build/temp.linux-x86_64-3.6/ibm_db.o
08-Aug-2020 07:57:40        ibm_db.c:27:20: fatal error: Python.h: No such file or directory
08-Aug-2020 07:57:40         #include <Python.h>
08-Aug-2020 07:57:40                            ^
08-Aug-2020 07:57:40        compilation terminated.
08-Aug-2020 07:57:40        error: command 'gcc' failed with exit status 1
08-Aug-2020 07:57:40        
08-Aug-2020 07:57:40        ----------------------------------------
08-Aug-2020 07:57:40    Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-fvpot_ia/ibm-db/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-yrktaypy-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-fvpot_ia/ibm-db/
08-Aug-2020 07:57:42    The command '/bin/sh -c python3.6 -m pip install -r scripts/requirements.txt' returned a non-zero code: 1
08-Aug-2020 07:57:42    make: *** [build] Error 1

The Dockerfile below is for an image to current versions of ibm_db and ibm_db_sa and SQLAlchemy for centos7.下面的 Dockerfile 是用于当前版本的 ibm_db 和 ibm_db_sa 的映像,以及用于 centos7 的 SQLAlchemy。

It works for x64 architecture without needing to compile ibm_db.它适用于 x64 架构,无需编译 ibm_db。

Change the Dockerfile to omit the packages that you do not need in your image.更改 Dockerfile 以省略映像中不需要的包。 Smaller images build quicker and use less storage.较小的图像可以更快地构建并使用更少的存储空间。

This Dockerfile shows an optional step to copy a preconfigured db2dsdriver.cfg into the image to the default location.此 Dockerfile 显示了将预配置的db2dsdriver.cfg复制到默认位置的映像的可选步骤。

This lets me use db2cli in the container to ensure connectivity to databases before using python ibm_db.这让我在使用 python ibm_db 之前,可以在容器中使用db2cli来确保与数据库的连接。

db2cli needs LD_LIBRARY_PATH to contain the clidriver\lib directory, to ensure db2cli validate will run. db2cli 需要 LD_LIBRARY_PATH 来包含 clidriver\lib 目录,以确保 db2cli validate 将运行。

 FROM centos:7


     RUN yum install -y \
       pam-devel \
       pam.i686 \
       libaio \
       libstdc++-devel.i686 \
       numactl-libs \
       gcc \
       gcc-c++ \
       ksh \
       numactl \
       file \
       kernel-devel \
       vi \
       sudo \
       util-linux \
       which \
       openssh-clients \
       zip \
       unzip \
       python3 \
       python3-devel \
       libssl_dev \
       openssl \
       openssl-devel \
       bzip2-devel \
       libffi \
       libffi-devel \
       libgcc \
       wget \
       make \
       git \
       libxml2 \
       && yum -y update \
       && yum clean all \
       && python3 -m pip install --upgrade pip \
       && python3 -m pip install ibm_db \
       && python3 -m pip install ibm_db_sa 
    
    ENV LD_LIBRARY_PATH="/usr/local/lib64/python3.6/site-packages/clidriver/lib:${LD_LIBRARY_PATH}"
    
    # Optional - copy a preconfigured db2dsdriver.cfg to the image default location for db2cli to work
    COPY db2dsdriver.cfg /usr/local/lib64/python3.6/site-packages/clidriver/cfg

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

相关问题 错误:命令“gcc”在 CentOS 上失败,退出状态为 1 - error: command 'gcc' failed with exit status 1 on CentOS 错误:在RHEL上安装pycrypto时,命令&#39;gcc&#39;失败,退出状态为1 - error: command 'gcc' failed with exit status 1 while installing pycrypto on RHEL 命令'gcc'在安装scrapy时失败,退出状态1错误 - command 'gcc' failed with exit status 1 error while installing scrapy 错误:安装 eventlet 时命令“gcc”失败,退出状态为 1 - error: command 'gcc' failed with exit status 1 while installing eventlet 错误:安装pylibrabbitmq时命令&#39;gcc&#39;失败,退出状态为1 - error: command 'gcc' failed with exit status 1 while installing pylibrabbitmq 错误:安装crf ++时,命令&#39;gcc&#39;失败,退出状态为1 - Error: command 'gcc' failed with exit status 1 while installing crf++ 错误:命令&#39;gcc&#39;失败,在centos 6.5上的退出状态为1 - error: command 'gcc' failed with exit status 1 on centos 6.5 在Centos 7上安装lxml - 错误:命令&#39;gcc&#39;失败,退出状态为4 - Install lxml on Centos 7 - error: command 'gcc' failed with exit status 4 安装超集:错误:命令“gcc”失败,退出状态为 1 - Installing superset: error: command 'gcc' failed with exit status 1 安装Reportlab(错误:命令&#39;gcc&#39;失败,退出状态为1) - installing Reportlab (error: command 'gcc' failed with exit status 1 )
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM