To get current Blender version number through the Python API we need to execute the following command:
1 2 3 |
bpy.app.version # (2, 81, 16) |
or
1 2 3 |
bpy.app.version_string # '2.81 (sub 16)' |
The first is preferable because it returns a tuple that is easy to compare:
1 2 3 4 5 6 7 8 9 10 11 |
bpy.app.version == (2, 81, 16) # True bpy.app.version == (2, 81, 17) # False bpy.app.version > (2, 81, 17) # False bpy.app.version < (2, 81, 17) # True |