Checking Python Version

This post explained how to check Python version used on Windows 10.

It is important to know what Python version you are using since there are some differences when writing code depending on Python version used.

Open a Command Prompt

We will check the Python version used through a Windows command prompt. A command prompt is an old school application available in most Windows versions. It’s used to execute commands by textual input as opposed to clicking on widgets in with the mouse in a graphical user interface.

We do the following to start a command prompt window in Windows 10:

  1. Locate a magnifying glass symbol on the Windows desktop. It will by default be close to the lower left corner off the screen.
  2. The magnifying glass is used to search for things in Windows 10. It can be activated by clicking on it with the mouse, but it is simpler and nerdier to just use the keyboard, so we instead use Windows key + q.
  3. Type the text Command Prompt in the activated search box and hit enter. This will launch a Command Prompt application that will look something like in the below figure.
A newly started Windows Command Prompt

Start a Python Interactive Prompt

We will now launch a Python Interactive prompt inside our Windows Command Prompt. This is done by typing the text Python. See below figure for expected result and note how we now have the so called chevron prompt with three arrows, instead of just one arrow as before. An interactive Python interpreter is running as long as we see this special three arrow prompt.

Python interpreter running in a Windows Command Prompt

Python Version

The python version is printed out when starting a Python interactive prompt, and we can int this case see that we have Python 3.7.3 installed.

Cleaning up

We shall finally close down the Python interactive prompt. On Windows 10 so is this done by pressing Ctrl + z followed by enter, when having the Command Prompt as the active window. This bring us back to the ordinary Windows prompt.

Back in ordinary Command Prompt mode

We can now just close down the Windows Command Prompt by clicking the cross in the top right corner of the window, or by using the short command Alt + F4.

Leave a Reply

Your email address will not be published. Required fields are marked *