1、更新相关的package
$ sudo apt-get update
2、安装相关的依赖包
$ sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
3、下载openCV3.2.0的源码并解压
$ wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.2.0.zip
$ unzip opencv.zip
4、编译安装
$ cd opencv-3.2.0
$ mkdir build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
$ make -4j
$ sudo make install
5、安装zbar
$ brew install zbar
$ sudo apt-get install libzbar0
$ python2 -m pip install pyzbar --user
6、验证安装
输入
$ python
在>>>后依次输入
>>> import cv2
>>> cv2.__version__
>>> import zbar
验证安装。
看懂了就给个赞呗~