简单介绍一下,.ubuntu16.04 ,python2.7/python3.6独立环境,pycharm运行简单的imshow图片,报出以下错误
cv2.imshow('2', img)
cv2.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
有人说是anaconda 安装opencv的问题。在pycharm中卸载opencv相关库,用pip安装,这样自动安装与python匹配的最新版opencv,即我安装的opencv最新版是opencv4.1,和opencv3系列差别不大可以用的
python -m pip install opencv-python
这一步完成重新运行不报错,SUCESS!
另外,网速慢的可以换一下源,具体可参照https://blog.csdn.net/lambert310/article/details/52412059
mkdir ~/.pip/
cat >~/.pip/pip.conf<<EOF
[global]
index-url = https://mirrors.ustc.edu.cn/pypi/web/simple
format = columns
EOF