install libgtk2.0-dev and pkg-config

opencv莫名出现该问题

error: (-2) The function is not implemented. Rebuilt 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 function cvSowImage

解决方法:

  1. 进入管理账户
sudo su
sudo apt-get install libgtk2.0-dev
  1. 编译目录

打开opencv_build/opencv/build,在该目录下运行:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_C_EXAMPLES=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_GENERATE_PKGCONFIG=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules \
    -D BUILD_EXAMPLES=ON ..

  1. 结束之后,编译内容
make -j8
  1. 安装
sudo make install

相当于又装了一遍,莫名其妙的问题,理解不了…
可能是装了什么东西冲突了,今天只是配置了torch,结果两个都废了…

你可能感兴趣的:(问题解决,OpenCV,libgtk2.0-dev,opencv,ubuntu,18.04)