![]() | 1 | initial version |
1. Inspect First
Printing out the value of cv2.__version__
first before assigning it.
By doing so in my machine, I got the value
3.3.0-dev
From here you can tell that you actually need three variables instead of four hence
major_version, minor_version, type = cv2.__version__.split('.')
should work just fine.
2. Dynamic
In the event that you do not have the luxury of doing a quick check of your results, you can refer back to native Python APIs.
result = cv2.__version__.split('.')
split() returns a list consisting of the substrings.
From here, result
consists of
['3', '3', '0-dev']
Example usage of split()