How to Find the Version of Python You Have Installed On Your Computer 


               


How to Find the Version of Python that You Have Installed On Your Computer



Python


In this article, we show how find the version of Python that you have installed on your computer using the command prompt or the sys module.

There 2 ways that you can check to see which version of Python you have installed. Of course, you can just look at the package you installed, but you're specifically discussing ways in this article how to do it programmatically.

We'll first go over the command prompt method and then the method using the sys module.


Command Prompt

So what you can do is open up your command prompt on your computer.

If you are on a Windows PC, in the command prompt, type in the following line.



You may have to type in, python instead of py on some systems.

In a non-Windows PC, such as Linux, the line would be as follows.



But with this single line, it will be revealed what version of Python that you have installed on your computer.

This can be seen in the image below.

Python version on a command prompt on a Windows PC

So using the command prompt is one of checking.


How to Find the Version of Python using the sys Module

The other way of checking for the version of Python is by using the sys module.

So go into a shell that is capable of running Python code and type in the following.



Running the above code, I get the following output shown below.



So these are 2 quick ways of checking the version of Python that you currently have installed on your computer.


Related Resources

How to Randomly Select From or Shuffle a List in Python



HTML Comment Box is loading comments...