Latest Posts

Wednesday, November 30, 2022

How to check version of Python on Windows/Linux and MacOs

Python is a modern programming language and is very popular. After C and C++, Python has emerged as the true programing language which can handle hardware as well as data.


Standard commands are used to find the version of python installed on a system depending on the operating system.


Prerequisites  

Access to a command-line/terminal window:

  • Linux:  Ctrl-Alt-T, Ctrl-Alt-F2
  • Windows:  Win+R > type PowerShell > Enter/OK
  • macOS:  Finder > Applications > Utilities > Terminal

There are different versions of Python, but the two most popular ones are Python 2.7.x and Python 3.7.x. The x stands for the revision level and could change as new releases come out.


Find/Check the version of python on Linux 

Open a terminal and run the below command 

python --version

Find/Check the version of python on Windows

Open a PowerShell window and run the below command

python --version

Find/Check the version of python on macOS

python --version


Find/Check the version of python if multiple version is installed

1. To check for Python 2.7.x:

python --version

2. To check for Python 3.x.x

Python 3 is backwards compatible so 2.x.x application can work with python 3

python3 --version


No comments:

Post a Comment