docker 错误:subprocess-exit-with-error ×运行setup.py安装lru-dict没有成功运行

g0czyy6m  于 2023-01-20  发布在  Docker
关注(0)|答案(1)|浏览(345)

我尝试使用AWS EC2 Ubuntu构建容器映像,以便为需要www.example.com库的python脚本推送AWS ECR Repository。但是,它向我抛出了一个错误,我不确定如何修复。我使用AWS ECR推送命令来完成此操作。web3.py library. However, it is throwing me an error that I'm not sure how to fix. I am using AWS ECR push commands to do it.
命令为:docker build -t docker-lambda.
我的停靠文件:

FROM public.ecr.aws/lambda/python:3.8

COPY requirements.txt ./

RUN pip3 install -r requirements.txt

COPY app.py ./

CMD ["app.lambda_handler"]

requirements.txt:

web3

错误信息:

error: subprocess-exited-with-error

  × Running setup.py install for lru-dict did not run successfully.
  │ exit code: 1
  ╰─> [9 lines of output]
      running install
      running build
      running build_ext
      building 'lru' extension
      creating build
      creating build/temp.linux-x86_64-3.8
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/var/lang/include/python3.8 -c lru.c -o build/temp.linux-x86_64-3.8/lru.o
      unable to execute 'gcc': No such file or directory
      error: command 'gcc' failed with exit status 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> lru-dict

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
kmbjn2e3

kmbjn2e31#

构建这个lru-dict需要一些c包和库。安装gcc工具:

sudo apt-get install build-essential

沿着用于开发的Python工具:

sudo apt-get install python3-dev

在容器里也试一试...这个应该能用

相关问题