use Anaconda to install OpenCV under Ubuntu
Recently under the Ubuntu16.04 use Anaconda installs the OpenCV, encounters many pits, records the memo. Can be directly pip installation OpenCV, but unable to read the video, need to compile the source code.
Anaconda Installing the OPENCV process
1. Cannot compile OpenCV with Anaconda installed, compile will link Anaconda Library, compile program will error. Installed first remove
1. To the root directory, open the terminal and enter:
sudo gedit ~/.bashrc
2. Comment out the previously added path (or delete it directly) at the end of the. bashrc file with the # number:
#export path=/home/lq/ Anaconda3/bin: $PATH
Save and close the file
3. Make it effective immediately in terminal execution:
source ~/.BASHRC
4.anaconda Modify Location or delete
5. Best reboot
2 Installing OPENCV
Prerequisites # Install build tools $ sudo apt-get install build-essential cmake git # install OpenCV dependencies $ sudo Apt-get Install pkg-config Libgtk2.0-dev # Install SSL for HTTPS, v4l for video $ sudo apt-get install Libssl-dev libv4l-d EV v4l-utils Install OpenCV 3.2 $ git clone https://github.com/opencv/opencv.git $ cd opencv/$ git checkout tags/3.2.0 $ CD opencv/$ mkdir build $ cd build/$ cmake \-dcmake_build_type=release \-dcmake_install_prefix=/usr/local \ \-dwith_c
Uda=off \-dbuild_docs=off \-dbuild_examples=off \-dbuild_tests=off \-dbuild_perf_tests=off \. # If CMake hangs during "icv:downloading ippicv_linux_20151201.tgz ..." $ icv_path=: /3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e/ippicv_linux_20151201.tgz && \ ICV_URL= Https://github.com/opencv/opencv_3rdparty/raw/ippicv/master_20151201/ippicv/ippicv_linux_20151201.tgz & & \ rm-f $ICV _path && wget $ICV _url && mv ippicv_linux_20151201.tgz $ICV _path $ make -j$ (Nproc--all) $ sudo make install
3 Installing OPENCV in Anaconda
Copy the/usr/local/lib/python2.7/site-packages/cv2.so to the anaconda corresponding directory
Pip Install Opencv-python