AttributeError: module 'cv2.face' has no attribute 'recognizer = cv2.face.LBPHFaceRecognizer_create'

问题遇到的现象和发生背景

树莓派上在opencv3.2.0中出现AttributeError: module 'cv2.face' has no attribute 'recognizer = cv2.face.LBPHFaceRecognizer_create' 我的python版本为3.7.3

问题相关代码,请勿粘贴截图

img

运行结果及报错内容

Traceback (most recent call last):
File "/home/pi/Desktop/mycodetest/opencv/09训练数据.py", line 45, in
recognizer=cv2.face.LBPHFaceRecognizer_create()
AttributeError: module 'cv2.face' has no attribute 'LBPHFaceRecognizer_create'

你有这个嘛?opencv-contrib-python

没有就
pip install opencv-contrib-python

建议你看下这篇博客关于 AttributeError: module ‘cv2.face‘ has no attribute ‘createLBPHFaceRecognizer‘ 的问题

pip install opencv-contrib-python