报错信息:AttributeError: module ‘cv2‘ has no attribute ‘face‘

报错信息:AttributeError: module 'cv2' has no attribute 'face'

  • 问题描述
  • 解决方法

问题描述

在使用pycharm做人脸识别项目时,调用OpenCV库,也就是cv2库中的face模块时,程序报错,信息如下

报错信息:AttributeError: module ‘cv2‘ has no attribute ‘face‘_第1张图片

解决方法

face模块实际上并不是opencv库的一部分。更确切地说,face是部分的的opencv-contrib库。所以,需要安装opencv-contrib库。

方法一:可以使用cmd进行安装

pip install opencv-contrib-python

在这里插入图片描述

方法二:如果使用的是pycharm ,也可以在pycharm中进行安装
报错信息:AttributeError: module ‘cv2‘ has no attribute ‘face‘_第2张图片

报错信息:AttributeError: module ‘cv2‘ has no attribute ‘face‘_第3张图片
报错信息:AttributeError: module ‘cv2‘ has no attribute ‘face‘_第4张图片

你可能感兴趣的:(随笔,python,opencv,开发语言)