2017-09-28 21 views
1

インストールしたいzbarlight Python 3.5のPythonパッケージをDocker Imageにインストールします。 Requirements.txtファイルは以下の通りだったDockerのpython3.5用zbarlight pythonパッケージのインストール

Flask==0.12.2 
google-cloud==0.27.0 
gunicorn==19.7.1 
Pillow==4.2.1 
numpy==1.13.1 
Werkzeug==0.12.2 
oauth2client==3.0.0 
zbarlight==1.2 

エラー以下の通りである

FROM python:3.5 
WORKDIR /app 
ADD . /app 
RUN pip3 install -r requirements.txt 
EXPOSE 80 
CMD ["python", "main.py"] 

以下のよう

Dockerfileでした。その後、私は

sudo apt-get install libzbar-dev 

介してローカルlibzbar-DEVインストールさ

gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python3.5m -c src/zbarlight/_zbarlight.c -o build/temp.linux-x86_64-3.5/src/zbarlight/_zbarlight.o -std=c99 
src/zbarlight/_zbarlight.c:3:18: fatal error: zbar.h: No such file or directory 
#include <zbar.h> 
       ^
compilation terminated. 
error: command 'gcc' failed with exit status 1 

そして以下試みローカルコマンド。上記のコマンドの上記のコマンドの

dpkg -L libzbar-dev 

応答

/. 
/usr 
/usr/share 
/usr/share/doc 
/usr/share/doc/libzbar-dev 
/usr/share/doc/libzbar-dev/copyright 
/usr/include 
/usr/include/zbar.h 
/usr/include/zbar 
/usr/include/zbar/Image.h 
/usr/include/zbar/Processor.h 
/usr/include/zbar/Symbol.h 
/usr/include/zbar/Decoder.h 
/usr/include/zbar/Scanner.h 
/usr/include/zbar/Exception.h 
/usr/include/zbar/Video.h 
/usr/include/zbar/Window.h 
/usr/include/zbar/ImageScanner.h 
/usr/lib 
/usr/lib/x86_64-linux-gnu 
/usr/lib/x86_64-linux-gnu/libzbar.a 
/usr/lib/x86_64-linux-gnu/pkgconfig 
/usr/lib/x86_64-linux-gnu/pkgconfig/zbar.pc 
/usr/share/doc/libzbar-dev/changelog.Debian.gz 
/usr/lib/x86_64-linux-gnu/libzbar.so 

第二コマンド

ls -l /usr/include/zbar.h 

レスポンス。

-rw-r--r-- 1 root root 47339 Jan 28 2016 /usr/include/zbar.h 

その後、Dockerfileの最初の2行が追加されました。

FROM ubuntu:16.04 
RUN apt-get update; apt-get install -yV libzbar0 libzbar-dev; dpkg -L libzbar-dev; ls -l /usr/include/zbar.h; apt-get update 
FROM python:3.5 
WORKDIR /app 
ADD . /app 
RUN pip install -r requirements.txt 
EXPOSE 80 
CMD ["python", "main.py"] 

ドッカー画像を構築する際に重要なスクリーンショットはほとんどありません。

Responses : dpkg -L libzbar-dev & ls -l /usr/include/zbar.h

The Final Error

答えて

0

私は以下のように私のDockerfileを変更しました。

FROM ubuntu:16.04 
RUN apt-get update 
RUN apt-get install -y zbar-tools libzbar-dev python-zbar 
RUN dpkg -L libzbar-dev; ls -l /usr/include/zbar.h 
RUN apt-get update 
RUN apt-get install -y python3.5 
WORKDIR /app 
ADD . /app 
RUN rm /usr/bin/python 
RUN ln -s /usr/bin/python3.5 /usr/bin/python 
RUN apt-get install -y python3-pip 
RUN apt-get install -y python3-venv 
RUN pip3 install -r requirements.txt 
EXPOSE 80 
CMD ["python", "main.py"] 

私は、Python 3.5の公式ドッカーの画像を使用しての私の心を変えたように、私はパッケージとしてP​​ythonをインストールしました。 デフォルトのpythonのバージョンを変更しました(修正されたソフトリンク)。

関連する問題