opencv2安装
opencv import error
# 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
cp /usr/local/lib/python2.7/site-packages/cv2.so ~/anaconda2/lib/python2.7/site-packages
在导入的时候可能会出现如下错误
>>> import cv2
Traceback (most recent call last):
File "" , line 1, in
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'