19
$\begingroup$

How do I go about programmatically getting the Blender version number?

Example: If I am running Blender 2.76, how would I get the version number from the python console?

$\endgroup$
1
  • $\begingroup$ Just out of curiosity, why do you want to do that with python? It seems much easier and faster to me to simply click on the splash screen. $\endgroup$ Commented Jul 23, 2020 at 18:42

2 Answers 2

34
$\begingroup$

bpy.app.version_string

Test using the python console:

>>> bpy.app.version_string '2.83.2' 

Usage within a script file:

import bpy print(bpy.app.version_string) 

which will print the actual version to the system console window:

2.83.2 

bpy.app.version

If you're looking to compare version numbers, it's easier to do this using bpy.app.version which will always be a tuple of 3 ints, (major, minor, subversion), eg: (2, 76, 0)

So you can compare the version number with regular comparison.

if (2, 76, 0) > bpy.app.version: print("Your Blender version is too old!") 
$\endgroup$
0
0
$\begingroup$

Either open up a Text Editor area or just switch the Workspace to Scripting. Create a new document with the following contents and click run script or just press AltP:

import bpy print(bpy.app.version_string) 

In the main menu bar go to Window > Toggle System Console to display the requested blender version in Blender's Console Window.

$\endgroup$
2
  • 4
    $\begingroup$ How this is different to the existing answer? $\endgroup$ Commented Jul 23, 2020 at 12:54
  • 2
    $\begingroup$ Would point out the OP asked for python console code, no print necessary. Those of us using Linux or Mac versions of blender do not have the toggle system console menu item. Agree with @brockmann comment, this adds very little in way of new information. $\endgroup$ Commented Jul 23, 2020 at 13:59

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.