经过无数次安装,卸载opencv,感觉自己萌萌哒。。。
1.1:opencv2.4.8安装
sudo apt-get install libopencv-dev
1.2:opencv2.4.8卸载
sudo apt-get --purge remove libopencv-dev
2.1:opencv2.4.9安装
下载源码包:https://github.com/opencv/opencv
注意要选择2.4.9分支再下载!
接着:
mkdir build
cd build
cmake ..
make
sudo make install
默认情况下,安装完的头文件在/usr/local/include/,里面有opencv和opencv2的头文件,基本只用opencv2。
库文件就在/usr/local/lib/下面。
2.2:opencv2.4.9卸载
进入opencv安装包的build文件执行:
sudo make uninstall
cd ..
sudo rm -r build
sudo rm -r /usr/local/include/opencv2 /usr/local/include/opencv /usr/include/opencv /usr/include/opencv2 /usr/local/share/opencv /usr/local/share/OpenCV /usr/share/opencv /usr/share/OpenCV /usr/local/bin/opencv* /usr/local/lib/libopencv*
若提示默写路径没找到,可忽视。
3.1:opencv2.4.13安装
https://github.com/Itseez/opencv/archive/2.4.13.zip
下载并解压,然后:
cd opencv-2.4.13
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv2.4.13 ..
sudo make install
3.2:opencv2.4.13卸载
由于上述安装完的库文件和头文件单独存在于/usr/local下的一个名为opencv2.4.13的文件夹,所以直接删除此文件夹,再删除opencv2.4.13的安装包即可。