AttributeError: module 'cv2' has no attribute 'face' problem solving

There was a problem when training the face recognition model this morning. I found that the cv2 module has no face attribute. I searched the problem on the Internet and found that the face module is not actually a part of opencv. More precisely, face is part of the opencv-contrib library.
So I tried to install pip in the terminal command, but I kept reporting an error. Uninstalling and reinstalling opencv-python didn’t work. Finally, I tried to find the opencv-contrib-python package in the python interpreter in the pycharm settings and installed it. I didn’t expect it to succeed. up.

Guess you like

Origin blog.csdn.net/Tinyfacture/article/details/131656735