LoginSignup
2
2

More than 5 years have passed since last update.

Docker + ubuntu16.04 + python3.6.5 + opencv3.4.0

Posted at

最近"no module named cv2"で相当うんざりしたので

とりあえずこれでDockerfile作ってビルドすれば通る

メモとして残す

(opencvは3.4.1にバグがあるって話を聞いたので一応3.4.0にしておく)

FROM ubuntu:16.04

ENV DEBCONF_NOWARNINGS yes
RUN rm -rf /var/lib/apt/lists/*
RUN apt-get clean
RUN apt-get update -yq
RUN DEBIAN_FRONTEND=noninteractive apt-get -yq install build-essential cmake curl \
    gcc git libssl-dev libbz2-dev libreadline-dev libsqlite3-dev libglib2.0-0 libfontconfig1 \
    libxrender1 libsm6 libxext6 make pkg-config python-dev python-pip unzip vim wget zip zlib1g-dev
ENV PYTHONIOENCODING "utf-8"

# pythonの環境準備
ENV HOME  /
ENV PYENV_ROOT $HOME/.pyenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
RUN git clone https://github.com/yyuu/pyenv.git .pyenv
RUN pyenv install 3.6.5
RUN pyenv global 3.6.5

RUN pip install --upgrade pip
RUN pip install opencv-python==3.4.0.12

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2