opencv window.cpp:1333:error: (-2:Unspecified error) The function is not implemented

error: (-2:Unspecified error) The function is not implemented. 
Rebuild the library with Windows, GTK+ 2.x or Cocoa support. 
If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, 
then re-run cmake or configure script in function 'cvWaitKey'

解决方案:

根据报错信息,在终端中
sudo apt-get install libgtk2.0-dev
sudo apt-get pkg-config
然后切换到之前的opencv/build目录

cmake-gui

添加
opencv window.cpp:1333:error: (-2:Unspecified error) The function is not implemented_第1张图片
opencv window.cpp:1333:error: (-2:Unspecified error) The function is not implemented_第2张图片
添加完成后,config然后generate
返回终端,输入make -j8,等待编译完成,之后下载sudo make install
最后把在usr/local/python3.8/site-packages下的cv2文件夹发送到默认文件夹下,
如果不知道默认文件夹在那里,那就在运行的python工程下随便导入一个包
比如,在终端:

python3
import numpy as np
print(np.__file__)

之后看输出的路径在那里就可以了。
如果在anaconda,操作类似。

你可能感兴趣的:(opencv,python,人工智能)