banner



How To Find Where Python Is Installed Windows

Introduction

Which version of Python do I accept installed?

Python is a popular programming language. Like many other programming languages, at that place can be several different versions organized past release appointment. Certain applications may crave a specific version of Python.

In this tutorial, learn how to check the Python version on Windows, Linux, or macOS systems.

tutorial on how to check Python version.

Prerequisites

Access to a command-line/terminal window:

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

In that location are different versions of Python, but the two well-nigh pop ones are Python 2.7.x and Python 3.7.x. The x stands for the revision level and could modify as new releases come out.

When looking at the version number, there are usually three digits to read:

  1. the major version
  2. the minor version
  3. the micro version

While major releases are non fully uniform, minor releases generally are. Version 3.half dozen.1 should exist compatible with iii.7.ane for instance. The final digit signifies the latest patches and updates.

Python 2.vii and three.7 are different applications. Software that'due south written in i version often will not piece of work correctly in another version. When using Python, information technology is essential to know which version an awarding requires, and which version you have.

Python 2 will stop publishing security updates and patches after 2020. They extended the deadline because of the large number of developers using Python 2.7. Python three includes a 2 to 3 utility that helps translate Python 2 code into Python iii.

How to Cheque Python Version in Linux

Most mod Linux distributions come with Python pre-installed.

To check the version installed, open a final window and inbound the following:

          python --version        
python version linux

How to Check Python Version in Windows

Virtually out-of-the-box Windows installations do not come with Python pre-installed. However, it is always a good idea to check.

Open Windows Powershell, and enter the following:

          python --version        

If you have Python installed, information technology will report the version number.

check python version windows

Alternately, use the Windows Search office to come across which version of Python you lot have:

Press the Windows key to get-go a search, then blazon Python. The system will render any results that match. Most likely a match will show something like to:

          Python 3.7 (32-bit)  app        

Or,

          Python 2.7 (32-chip)  app        

This defines which major and minor revision (3.x or 2.x) you are using.

How to Bank check Python Version in MacOS

If using a MacOS, cheque the Python version by entering the post-obit command in the terminal:

          python -version        

The system will written report the version.

check python version macos

Note: In some cases, this will return a screen full of data. If that happens, just scan through the file locations for the word python with a number after it. That number is the version.

Checking a System with Multiple Versions of Python

Python2 and Python3 are dissimilar programs. Many programs upgrade from the older version to the newer 1. Yet, Python two.seven.ten installations tin can be run separately from the Python 3.vii.ten version on the same system.

Python three is not entirely backward compatible.

To cheque for Python 2.vii.x:

          python --version        

To check the version of Python 3 software:

          python3 --version        

Most systems differentiate Python ii every bit python and Python iii as python3. If you do not accept Python 2, your system may use the python command in place of python3 .

Note: Python does not take a congenital-in upgrade system. You'll need to download the latest version and install information technology.

How to Check Python Version in Script

When writing an application, it is helpful to take the software bank check the version of Python earlier information technology runs to preclude crashes and incompatibilities.

Use the post-obit code snippet to check for the right version of Python:

          import sys        
          if not sys.version_info.major == 3 and sys.version_info.minor >= 6:      print("Python iii.6 or higher is required.")      impress("You are using Python {}.{}.".format(sys.version_info.major, sys.version_info.minor))      sys.exit(1)        

When this script runs, information technology will test to see if Python three.6 is installed on the system. If not, it will send a notification and displays the electric current Python version.

Decision

You should at present have a solid understanding of how to cheque for the version of Python installed in several different operating systems. Python is a powerful programming language, thus it'southward important to understand its different versions.

If you want to learn how to upgrade Python to a newer version on Wondows, macOs, and Linux, check our article how to upgrade Python to 3.9.

Was this commodity helpful?

Yep No

Source: https://phoenixnap.com/kb/check-python-version

Posted by: coatesperis1986.blogspot.com

0 Response to "How To Find Where Python Is Installed Windows"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel