![](https://csdnimg.cn/release/download_crawler_static/86085288/bg5.jpg)
FROM pytorch/pytorch
LABEL DESC=“EasyOCR Enviroment Build with Containerd Images”
ARG service_home=“/home/EasyOCR”
# Enviroment && Software
RUN sed -i -e “s#archive.ubuntu.com#mirrors.aliyun.com#g” -e
“s#security.ubuntu.com#mirrors.aliyun.com#g” /etc/apt/sources.list && \
apt-get update -y && \
apt-get install -y \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgl1-mesa-dev \
git \
vim \
# cleanup
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists
# COPY EasyOCR is (https://.com/JaidedAI/EasyOCR.git)
COPY ./EasyOCR “$service_home”
# Build
RUN cd “$service_home” \
&& pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ \
&& python setup.py build_ext --inplace -j 4 \
&& python -m pip install -e .
环境验证
# Windows 环境
pip freeze | findstr “easyocr”
easyocr @
file:///E:/%E8%BF%85%E9%9B%B7%E4%B8%8B%E8%BD%BD/easyocr-1.4.2-py3-none-any.
whl
# Linux & 容器环境
$ pip freeze | grep “EasyOCR”
-e
git+https://.com/JaidedAI/EasyOCR.git@7a685cb8c4ba14f2bc246f89c213f1a56bbc2107#egg=ea
syocr