Ubuntu16.04+anaconda2+opencv3.2.0

Posted qq_784583650

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu16.04+anaconda2+opencv3.2.0相关的知识,希望对你有一定的参考价值。

参考

opencv2安装
opencv import error

1.opencv编译安装

# Get all the up-to-date tools you'll need
sudo apt-get update
sudo apt-get install git cmake build-essential

# Get latest greatest OpenCV from GitHub
git clone https://github.com/opencv/opencv.git

# Go build and install that puppy
cd opencv
mkdir build
cd build
cmake ..
make -j 8 
sudo make install

2.在python中导入

cp /usr/local/lib/python2.7/site-packages/cv2.so ~/anaconda2/lib/python2.7/site-packages

在导入的时候可能会出现如下错误

>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /home/liu/anaconda2/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/lib/libopencv_ml.so.3.2)

安装opencv-python

pip install opencv-python

成功导入

In [1]: import cv2

In [2]: cv2.__version__
Out[2]: '3.2.0'

以上是关于Ubuntu16.04+anaconda2+opencv3.2.0的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu16.04下同时安装Anaconda2与Anaconda3

caffe--anaconda2--makefile.config--compile --ubuntu16.04

Ubuntu16.04+matlab2014a+anaconda2+OpenCV3.1+caffe安装

Ubuntu16.04+matlab2014a+anaconda2+OpenCV3.1+caffe安装

Ubuntu16.04+matlab2014a+anaconda2+OpenCV3.1+caffe安装

Ubuntu16.04安装xgboost