Opencv error: attributeerror: module ‘CV2’ has no attribute ‘data’
the following error will appear when running the face detection code:
face_detector = cv.CascadeClassifier(cv.data.haarcascades + "haarcascade_frontalface_alt2.xml")
eye_detector = cv.CascadeClassifier(cv.data.haarcascades + "haarcascade_eye.xml")
smile_detector = cv.CascadeClassifier(cv.data.haarcascades + "haarcascade_smile.xml")
AttributeError: module 'cv2' has no attribute 'data'
Solution: uninstall your existing opencv Python and install my version of OpenCV
1. Open Anaconda prompt and enter
pip uninstall opencv-python
2. Re input
pip install opencv-python -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
Note: when uninstalling opencv, select y, and don’t worry about red explosion
Read More:
- [Jeston Xavier NX Compile librealsense Error] AttributeError: module ‘pyrealsense2‘ has no attribute ‘pipeline‘
- [Solved] AttributeError: module ‘keras.preprocessing.image‘ has no attribute ‘load_img‘
- [Solved] Raspberry Pi Error: AttributeError: module ‘serial‘ has no attribute ‘Serial‘
- TensorFlow error: AttributeError: module ‘tensorflow_core._api.v2.train’ has no attribute ‘Optimizer‘
- [Solved] AttributeError: ‘depthai.node.ObjectTracker‘ object has no attribute ‘setTrackerIdAssigmentPolicy‘
- ROS package executes rosrun error: attributeerror: ‘thread’ object has no attribute ‘isalive‘
- [Solved] redis Error: AttributeError: ‘list‘ object has no attribute ‘decode‘
- [Solved] AttributeError: ‘openvino.inference_engine.ie_api.IENetwork‘ object has no attribute ‘input_info‘
- Pyqt5 Error: AttributeError: ‘QWidget‘ object has no attribute ‘setCentralWidget‘
- PySpark error: AttributeError: ‘NoneType‘ object has no attribute ‘_jvm‘
- Tensorflow error: attributeerror: module ‘tensorflow_ API. V1. Train ‘has no attribute’ summarywriter ‘
- [Solved] AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
- [Solved] AttributeError : ‘GridSearchCV‘ object has no attribute ‘grid_scores_‘
- Peewee insert data error:’buffer’ object has no attribute’translate’
- [Solved] Module ‘scipy.misc‘ has no attribute ‘imread‘
- module ‘networkx’ has no attribute ‘from_pandas_dataframe’
- [How to Solve] Tesorflow: module ‘pandas.core.computation’ has no attribute ‘expressions’
- Pytorch error: `module ‘torch‘ has no attribute ‘__version___‘`
- Yolox_s.pth Convert to tensorRT Error: AttributeError: ‘tensorrt.tensorrt.Builder‘ object has no attribute ‘max_workspace_size‘
- Attributeerror encountered when using ceilometer and gnocchi to execute commands related to gnocchi metric list: _Environ instance has no attribute ‘