Net-informations.com

How to Check Your Python Version?

You can use the standard library sys module or platform module to get the version of Python that is actually running.


Check Python Version Windows 10

From command line

You can see which version of Python is installed on your OS using the command line .

  1. python -V

(Note: capital 'V')


Check Python version from command line / in script

Which version of Python is running my script?

In Python 2.7 and later, the components of sys.version_info can also be accessed by name, so sys.version_info[0] is equivalent to sys.version_info.major and so on.

Here, sys.version_info[0] is the major version number. sys.version_info[1] would give you the minor version number.

Platform Module in Python

Python defines an in-built module platform that provides system information. You can use the platform module to get the version of Python that is actually running.

Python is being updated regularly with new features and supports. There are lots of update in Python versions, started from 1994 to current release. Python Implementation started on December, 1989 and reached version 1.0 in January 1994. Like many other programming languages, there can be several different versions organized by release date.

Python Versions

The standard version scheme is designed to encompass a wide range of identification practices across public and private Python projects. A tuple containing the five components of the version number : major, minor, micro, releaselevel, and serial. All values except release level are integers; the release level is 'alpha', 'beta', 'candidate', or 'final'. The version_info value corresponding to the Python version 2.0 is (2, 0, 0, 'final', 0).

Run the Python command-line interpreter:

  1. Open Command line: Start menu -> Run and type cmd
  2. Type: C:\Python34\python.exe

How to Check Python Version in Various OS

Here you can see, Python version is displayed on console immediately as you start interpreter from command line. The details are a string containing the version number of the Python interpreter plus additional information on the build number and compiler used.

From command line

You can check which version of Python is installed on your operating system using the command line using the following command.

  1. C:\Python34> Python -c "print(__import__('sys').version)"

How to check Python version in Mac Linux Unix

Check Python Version from your program

You can programmatically determine which version of Python is installed on the system where the Python script is running.

For example, to check that you are running Python 3.x , use:










net-informations.com (C) 2020    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About