module 'cv2' has no attribute 'imread'
- Python
- OpenCV
You may see
Why it happens
- Your file is named
cv2.py. - The part you need is in opencv-contrib-python.
How to fix it
- Rename your file, and delete the
__pycache__folder. - For extras such as
cv2.faceinstall only opencv-contrib-python.
It worked if: print(cv2.__file__) shows site-packages.
Related errors
Tutorials where it can happen
Seen in a real run (some lines are close variants of it). Produced with Python 3.13 and OpenCV 5.1 on Windows.
Didn't help? Search another error or ask us.

