在windows下python调用opencv进行人脸预测,提示以下问题:
cv2.namedWindow("Image")
cv2.error: OpenCV(4.5.3) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-z4706ql7\opencv\modules\highgui\src\window.cpp:1257: 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 'cvNamedWindow'
解决方法是进入到你的环境中,使用如下命令安装opencv-contrib-python:
pip install opencv-contrib-python
之后程序就可以正常运行啦!