Lambda层中没有包装ZBAR

发布于 2025-02-13 02:44:26 字数 571 浏览 1 评论 0原文

试图为我的lambda函数创建图层,该函数使用pyzbar库,该库需要单独下载ZBAR共享库作为依赖关系,并且无法与PIP一起安装。我的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"]

而且我的要求

opencv-python-headless
pyzbar
pyzbar[scripts]

没有包装ZBAR可用

当我用许多其他软件包名称替换“ ZBAR”时,我会遇到相同的错误

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. My Dockerfile looks like this:

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

opencv-python-headless
pyzbar
pyzbar[scripts]

I'm getting the error

No package zbar available

I'm getting the same error when I replace "zbar" with a number of other package names, e.g. libzbar0, libzbar-dev, zbar-tools, etc

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

倾`听者〃 2025-02-20 02:44:26

ZBAR不包含在默认的Amazon Linux存储库中,因此您需要添加EPEL回购。

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"]

zbar is not included in the default amazon linux repo, so you need to add the 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"]
故人爱我别走 2025-02-20 02:44:26

您尝试安装
https://pypi.org/project/project/pyzbar/ 而不是pip,而不是
https://anaconda.org/conda-forge/conda-forge/pyzbar ://docs.conda.io/en/latest/miniconda.html” rel =“ nofollow noreferrer”> conda 。

PIP非常擅长快速求解Pure-Python安装。
康达解决了不同类别的问题。
在这里,您希望从zbar中合并二进制文件
进入您的项目,您已经表达了一些
对PIP方法感到沮丧。

使用conda 环境.yml文件
是表达您要求的自然方式。
它将处理获得适合平台的二进制文件
对于您来说,因此您不必流汗细节。

You tried to install
https://pypi.org/project/pyzbar/ with pip, rather than
https://anaconda.org/conda-forge/pyzbar with conda.

Pip is very good at quickly solving pure-python installs.
Conda solves a different class of problems.
Here, you wish to incorporate binaries from zbar
into your project, and you have expressed some
frustration with the pip approach.

Using a conda environment.yml file
would be the natural way to express your requirements.
It will deal with obtaining platform-appropriate binaries
for you, so you don't have to sweat the details.

楠木可依 2025-02-20 02:44:26

我只有相同的问题,但是使用链接https://dl.fedoraproject.org/pub/pub/epel/epel-release-latest-7.noarch.rpm 对我不起作用[fedora删除链接:(]。

搜索很多后,我在Fedora People网站中找到了与Epel7的其他链接,对我有用:

yum -y install https://fedorapeople.org/groups/repos/dchen/epel7-collection/epel-7/x86_64/epel-release-7-5.noarch.rpm

I just have the same problem but using the link https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm didn't work for me [Fedora remove the link :( ].

After searching a lot, I found other link to EPEL7 in the fedora people site and It works for me:

yum -y install https://fedorapeople.org/groups/repos/dchen/epel7-collection/epel-7/x86_64/epel-release-7-5.noarch.rpm
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文