KRISHNANDU RANJN ROY
KRISHNANDU RANJN ROY

Reputation: 49

How to fix OpenCV unable to import in my pycharm

When I try to run my project in order to read an image, OpenCV shows this error:

Traceback (most recent call last):
  File "C:\Users\Krishhnandu\PycharmProjects\test\error.py", line 2, in <module>
    print(cv2.__version__)
AttributeError: module 'cv2' has no attribute '__version__'

Upvotes: 0

Views: 184

Answers (1)

Prakash Dahal
Prakash Dahal

Reputation: 4875

uninstall opencv using

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

Then reinstall using

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

Then use the following command

import cv2
print(cv2.__version__)

Upvotes: 1

Related Questions