1、更换国内镜像源
我在安装时使用过树莓派自带的源、上海大学镜像源(shu.edu.cn)、阿里源,安装过程中都出现了各种各样的问题,尝试解决未果。直至更换了清华源,一次性成功。
更换清华源参考:https://blog.csdn.net/la9998372/article/details/77886806
ps: 安装时有一部分需要4~5小时,为了不浪费时间,最好一开始就更换源
2、安装openCV3.1.4并测试
参考:https://blog.csdn.net/leaves_joe/article/details/67656340
ps:若做到最后一步测试时报错 (看标红部分,说明libgtk2.0安装有问题)
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvNamedWindow, file/home/media/Downloads/caffe/opencv-3.2.0/modules/highgui/src/window.cpp, line583
terminate called afterthrowing an instance of 'cv::Exception'
what(): /home/media/Downloads/caffe/opencv-3.2.0/modules/highgui/src/window.cpp:583:error: (-2) The function is not implemented. Rebuild the library with Windows,GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, installlibgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvNamedWindow
开始这样做:
1) 更换为清华源,参照第一条(清华源不行,尝试中科大源,都不行尝试重新安装gtk2.0时将依赖包降级安装)
2) 更换源以后删除掉opencv3.1.4目录下的release目录
cd ~/opencv-3.1.4
sudo rm -rf release
3) 按照第二条重新安装 ,opencv不需要重新下载了,即跳过下面步骤(ps:由于删除了release目录,所以重新编译仍然需要4~5小时)