如何让Docker上的Pycrypto正常工作?

时间:2019-09-04 14:43:38

标签: python-3.x docker dockerfile pycrypto

我在AWS lambda上成功使用Pychromeless repo

但是现在我需要使用pycrypto依赖,但是我得到了

configure: error: no acceptable C compiler found in $PATH 运行make docker-build时 (将pycrypto==2.6.1放在requirements.txt文件之后)。

this thread,有人说同样的问题:

“ gcc编译器不在$ PATH中。这意味着您没有安装gcc,或者它不在$ PATH变量中。”

因此尝试将apt-get install build-essential放置在Dockerfile上,但我知道了

/bin/sh: apt-get: command not found

然后,我尝试了yum install gcc

只能得到

The command '/bin/sh -c yum install gcc' returned a non-zero code: 1

Docker-lambda [信息页面](https://hub.docker.com/r/lambci/lambda/)说:

This project consists of a set of Docker images for each of the supported Lambda runtimes.

There are also a set of build images that include packages like gcc-c++, git, zip and the aws-cli for compiling and deploying.

所以我想我不需要安装gcc。也许gcc编译器不在$ PATH中,但是我不知道该如何解决。

这是dockerfile

FROM lambci/lambda:python3.6
MAINTAINER tech@21buttons.com

USER root

ENV APP_DIR /var/task

WORKDIR $APP_DIR

COPY requirements.txt .
COPY bin ./bin
COPY lib ./lib

RUN mkdir -p $APP_DIR/lib
RUN pip3 install -r requirements.txt -t /var/task/lib

解决这个问题有帮助吗?

1 个答案:

答案 0 :(得分:1)

好吧,好吧...今天对我来说是幸运的一天。

非常简单:我要做的就是替换

pycrypto==2.6.1

通过

pycryptodome

在我的requirements.txt文件上。

thread说:“强烈建议您不要使用pycrypto。它是旧的并且没有维护,并且包含许多漏洞。请使用pycryptodome-它兼容并且是最新的。”

就是这样! Docker使用pycryptodome可以很好地构建。

相关问题