一、在 Docker 中安装 Python notebooks 并包括 OpenCV
1.1 创建Dockerfile
1 FROM jupyter/base-notebook 2 3 USER root 4 5 # 更新系统 6 RUN apt-get update 7 8 # 安装 OpenCV 相关依赖 9 RUN apt-get install -y libsm6 libxext6 libxrender-dev 10 11 # 安装 OpenCV 库 12 RUN pip install opencv-python-headless 13 14 USER jovyan
1.2 构建Docker镜像
docker build -t notebook-opencv .
1.3 运行镜像
docker run -p 8888:8888 --name myopencv -d -it notebook-opencv
1.4 查看日志中会出现【http://127.0.0.1:8888/?token=<TOKEN>】 点击进入就行了
docker container logs -f myopencv
1.5 安装其他相关库(exec 进入容器)
docker exec -it --user root myopencv /bin/sh
pip install matplotlib
apt-get install tesseract-ocr
。。。
1.6 需要copy文件到容器或者从容器里copy文件出来
docker cp ./c.jpg 91d727d7c2ae:/home/jovyan/
二、Ubuntu 源码编译安装OpenCV
1 # 源码下载:https://opencv.org/releases/ 2 # 解压后进入目录 3 mkdir build 4 cd build 5 cmake -DOPENCV_GENERATE_PKGCONFIG=YES .. 6 make -j4 # 使用多核心编译 比较耗时 7 sudo make install 8 9 # OpenCV图片识别文字Golang开发环境搭建 10 sudo apt-get install tesseract-ocr 11 sudo apt-get install tesseract-ocr-chi-sim 12 sudo apt-get install libleptonica-dev 13 sudo apt-get install libtesseract-dev 14 15 go get github.com/disintegration/imaging 16 go get github.com/otiai10/gosseract/v2 17 go get gocv.io/x/gocv 18 19 sudo apt-get install libopencv-dev 20 sudo apt0get install libgtk2.0-dev
标签:get,sudo,环境,apt,OpenCV,dev,install,搭建 From: https://www.cnblogs.com/watermeloncode/p/17926029.html