[英]No package zbar available in lambda layer
trying to create a layer for my lambda function which uses the pyzbar library, which requires the zbar shared library as dependency, to be downloaded separately, and can't be installed with pip.试图为我的 lambda 函数创建一个层,该函数使用 pyzbar 库,它需要 zbar 共享库作为依赖项,需要单独下载,并且不能使用 pip 安装。 My Dockerfile looks like this:
我的 Dockerfile 看起来像这样:
FROM public.ecr.aws/lambda/python:3.8
COPY requirements.txt .
COPY lambda_function.py .
RUN pip install --upgrade pip &&\
pip install -r requirements.txt &&\
yum makecache &&\
yum -y install zbar
CMD [ "lambda_function.lambda_handler"]
and my requirements.txt like this我的 requirements.txt 像这样
opencv-python-headless
pyzbar
pyzbar[scripts]
I'm getting the error我收到错误
No package zbar available
没有可用的包 zbar
I'm getting the same error when I replace "zbar" with a number of other package names, eg libzbar0, libzbar-dev, zbar-tools, etc当我将“zbar”替换为许多其他包名称时,我遇到了同样的错误,例如 libzbar0、libzbar-dev、zbar-tools 等
You tried to install您尝试安装
https://pypi.org/project/pyzbar/ with pip, rather than https://pypi.org/project/pyzbar/用 pip,而不是
https://anaconda.org/conda-forge/pyzbar with conda . https://anaconda.org/conda-forge/pyzbar和conda 。
Pip is very good at quickly solving pure-python installs. Pip 非常擅长快速解决纯 python 安装问题。 Conda solves a different class of problems.
Conda 解决了另一类问题。 Here, you wish to incorporate binaries from
zbar
into your project, and you have expressed some frustration with the pip approach.在这里,您希望将
zbar
中的二进制文件合并到您的项目中,并且您对 pip 方法感到有些失望。
Using a conda environment.yml
file would be the natural way to express your requirements.使用 conda
environment.yml
文件将是表达您的要求的自然方式。 It will deal with obtaining platform-appropriate binaries for you, so you don't have to sweat the details.它将为您获取适合平台的二进制文件,因此您不必担心细节。
zbar
is not included in the default amazon linux repo, so you need to add the epel repo. zbar
不包含在默认的 amazon linux repo 中,因此您需要添加 epel repo。
FROM public.ecr.aws/lambda/python:3.8
COPY requirements.txt .
COPY lambda_function.py .
RUN pip install --upgrade pip &&\
pip install -r requirements.txt &&\
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm &&\
yum makecache &&\
yum -y install zbar
CMD [ "lambda_function.lambda_handler"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.