banner



How To Know Where Python Is Installed In Windows

Introduction

Which version of Python do I have installed?

Python is a popular programming language. Like many other programming languages, in that location can be several different versions organized by release date. Certain applications may require 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

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

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

  1. the major version
  2. the pocket-size version
  3. the micro version

While major releases are not fully compatible, minor releases generally are. Version 3.6.ane should be compatible with 3.7.1 for example. The last digit signifies the latest patches and updates.

Python two.vii and 3.vii are unlike applications. Software that'southward written in one version often will not work correctly in another version. When using Python, information technology is essential to know which version an application requires, and which version you lot have.

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

How to Bank check Python Version in Linux

Almost mod Linux distributions come with Python pre-installed.

To check the version installed, open a terminal window and entering the post-obit:

          python --version        
python version linux

How to Check Python Version in Windows

Most out-of-the-box Windows installations do not come up with Python pre-installed. Even so, it is ever a good thought to check.

Open Windows Powershell, and enter the following:

          python --version        

If y'all have Python installed, it will report the version number.

check python version windows

Alternately, use the Windows Search function to meet which version of Python you take:

Press the Windows key to start a search, then type Python. The arrangement will return whatever results that friction match. Well-nigh likely a lucifer will prove something similar to:

          Python 3.7 (32-bit)  app        

Or,

          Python 2.7 (32-bit)  app        

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

How to Check Python Version in MacOS

If using a MacOS, cheque the Python version by inbound the following command in the terminal:

          python -version        

The system volition study the version.

check python version macos

Note: In some cases, this will return a screen total of information. If that happens, but browse 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 different programs. Many programs upgrade from the older version to the newer one. However, Python ii.seven.x installations can be run separately from the Python 3.7.x version on the same system.

Python iii is not entirely astern uniform.

To cheque for Python ii.7.x:

          python --version        

To check the version of Python 3 software:

          python3 --version        

Almost systems differentiate Python 2 as python and Python 3 as python3. If y'all do not take Python 2, your organisation may use the python command in place of python3 .

Annotation: Python does not take a built-in upgrade system. Y'all'll need to download the latest version and install it.

How to Cheque Python Version in Script

When writing an application, it is helpful to have the software bank check the version of Python before it runs to foreclose crashes and incompatibilities.

Use the following code snippet to check for the right version of Python:

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

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

Conclusion

You lot should now accept a solid understanding of how to check for the version of Python installed in several dissimilar operating systems. Python is a powerful programming language, thus it's important to understand its dissimilar versions.

If y'all 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 article helpful?

Yes No

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

Posted by: overlyalifeen.blogspot.com

0 Response to "How To Know Where Python Is Installed In Windows"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel