AttributeError: module ‘cv2.cv2‘ has no attribute ‘face‘

FacialRecognition % python3 02_face_training.py
Traceback (most recent call last):
  File "02_face_training.py", line 21, in 
    recognizer = cv2.face.LBPHFaceRecognizer_create()
AttributeError: module 'cv2.cv2' has no attribute 'face'

AttributeError: module ‘cv2.cv2‘ has no attribute ‘face‘_第1张图片

问题解决方法

下载我们需要的相关的包

pip install opencv-contrib-python

或

pip3 install opencv-contrib-python

如果直接安装不行,就要全部卸载一遍,然后重新安装。

pip uninstall opencv-contrib-python
 
pip uninstall opencv-python
 
pip install opencv-python
 
pip install opencv-contrib-python


 

看到successfully之后就可以运行代码啦!

你可能感兴趣的:(Python,python,人工智能,深度学习)