在conda环境中使用opencv时报了这样的错
Traceback (most recent call last):
File “cvtest.py”, line 3, in
cv2.imshow(‘src’,src)
cv2.error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/highgui/src/window.cpp:632: error: (-2: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 function ‘cvShowImage’
不管遇到什么困难,微笑着面对他。(跑题了)
解决方法如下
- 首先如果你是通过conda命令安装的opencv,那么卸载他
conda uninstall opencv
- 然后使用pip命令安装opencv
pip install opencv-python
然后再去执行你的程序,他就没问题了