gpt4 book ai didi

python - 导入错误 : Unable to find zbar shared library on Flask

转载 作者:行者123 更新时间:2023-11-28 22:20:39 26 4
gpt4 key购买 nike

我正在尝试在 Docker 中的 Flask 服务器上使用 pyzbar 0.1.4

图像是我们创建的,基于取自 alpine 的 python 2.7。

通过

安装ZBar
apk update
apk add zbar

我在运行 dockerfile 时遇到以下错误

File "/usr/lib/python2.7/site-packages/pyzbar/pyzbar.py", line 8, in <module>
from .wrapper import (
File "/usr/lib/python2.7/site-packages/pyzbar/wrapper.py", line 166, in <module>
c_uint_p, # minor
File "/usr/lib/python2.7/site-packages/pyzbar/wrapper.py", line 159, in zbar_function
return prototype((fname, load_libzbar()))
File "/usr/lib/python2.7/site-packages/pyzbar/wrapper.py", line 135, in load_libzbar
raise ImportError('Unable to find zbar shared library')
ImportError: Unable to find zbar shared library

我正在尝试使用该库解码 QR 图像

码头文件

FROM buffetcontainerimages.azurecr.io/base/buffetcloud-python:0.1
RUN pip install --upgrade pip setuptools wheel
COPY wheeldir /opt/app/wheeldir
COPY *requirements.txt /opt/app/src/
RUN pip install --use-wheel --no-index --find-links=/opt/app/wheeldir \
-r /opt/app/src/requirements.txt
RUN pip install --use-wheel --no-index --find-links=/opt/app/wheeldir \
-r /opt/app/src/test-requirements.txt
COPY . /opt/app/src/
WORKDIR /opt/app/src
RUN python setup.py install
EXPOSE 5000
CMD dronedemo

和requirements.txt

requests>=2.18.4
flask>=0.12.2
mechanize>=0.3.6
regex>=2.4.136
PyPDF2>=1.26.0
bs4>=4.5.3
pyzbar>=0.1.4
openpyxl>=2.5.0
selenium>=3.9.0
matplotlib>=2.1.2

当pip安装zbar时

pip install zbar
Collecting zbar
Downloading zbar-0.10.tar.bz2
...
zbarmodule.h:26:18: fatal error: zbar.h: No such file or directory
#include <zbar.h>
compilation terminated.
error: command 'gcc' failed with exit status 1

最佳答案

在 Ubuntu 中安装 zbar-tools

sudo apt-get install zbar-tools

关于python - 导入错误 : Unable to find zbar shared library on Flask,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48792965/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com