I can successfully get the cv2 version from command line:
>>> import cv2
>>> cv2.__version__
'3.4.4'
But not when I run a script with that code in the Python 3.7.1 Shell (see image here)
import cv2
print (cv2.__version__)
Traceback (most recent call last):
File "B:\Users\Ravi\Desktop\Opencv2\cv2.py", line 1, in <module>
import cv2
File "B:\Users\Ravi\Desktop\Opencv2\cv2.py", line 2, in <module>
print (cv2.__version__)
AttributeError: module 'cv2' has no attribute '__version__'
How can I solve this problem? Not only the version but none of cv2 code works.