解决 If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or config

先大概说一下我的情况:

系统Ubuntu18.04

想用Python,所以直接装了Anaconda,Pycharm,然后用conda install …这种命令开始安装各种包。

装完了opencv之后读取图片有问题

error: -------src-dir-------/opencv-2.4.10/modules/highgui/src/window.cpp:501: 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, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage.

应该把安装时命令换成

conda install -c menpo opencv3

一定要用 menpo,别的就出错了。

具体步骤,先卸载opencv,再重新安装
conda remove opencv
conda install -c menpo opencv

pip install --upgrade pip
pip install opencv-contrib-python

你可能感兴趣的:(计算机视觉)