Python was released on February 20, 1991, by Guido van Rossum. As Rossum was creating Python, he was also reading “Monty Python’s Flying Circus”, a script of a popular BBC comedy series. He thus settled on the name as he considered the new language mysterious and unique. This general-purpose programming language has a wide variety of users, and you may have interacted with it unknowingly through the movie recommendations on Netflix. Python is also used in the creation of software that controls self-driving cars.  Some of the things you can do with Python are

Web development. Python is used in backend development (the processes that users don’t see). Flask and Django are examples of frameworks that are widely used in the development of APIs and backend servers.  Automation or scripting. If there is a job that you find yourself performing repeatedly, Python can help you automate it. Beginners, as well as experts, can use Python to automate various tasks such as sending emails, finding data online, sorting data, and downloading.  Data analysis and machine learning. Python has become one of the most sought programming languages by data scientists. Data analysts can now create data visualizations, conduct complex statistical calculations, manipulate & analyze and so much more.  Software testing and prototyping. In a software development setup, Python can be used in bug tracking, testing, and build control. Developers can automate tests and checks on new systems and apps using Python.  Business applications. The business world is wide, and some of the things that may come to mind are e-commerce applications, customer management systems, and ERP, to mention a few. A typical business setting will need applications that are easily readable, extensible, and scalable. Python offers such a solution through its platforms, such as Tryton. 

It is versatile. If you have interacted with other languages, you may have noted that some have a single or just two use cases. However, Python has more than five use cases, and still, its performance is unmatched.  Has multiple libraries and modules. There exist tons of libraries and modules created by third parties to expand on the use cases of Python. For instance, you can use Django for server-side web development.  Python is simple. This programming language mimics the natural language, making it suitable for even beginners.  Large and active community. Programming can be challenging at times. However, the presence of a big and supportive community means that there are people you can always turn to when you get stuck.  Open-source. Python is free to use and distribute. Engineers can thus tweak existing code, redistribute and create various solutions/ applications with it. 

Python 2 and Python 3: Difference

Python programming language has evolved a lot over the more than 3 decades that it has been in existence. One of the reasons you may want to check the Python version is to determine if you are using Python 2 or Python 3 to ensure that you build bug-free solutions, irrespective of whether you are a developer or a data expert.  Python 2 and Python 3 are the major versions in the Python world. There has been an ongoing debate on which is better. Let us check the difference between the two;

Python 2

Python 2 was introduced in 2000 by BeOpen Python Labs. This version was intended to make learning Python easy.  It was through Python 2 that the technical details of the Python Enhancement Proposal (PEP) were implemented. In January 2020, Python 2 was sunsetted, which means it will no longer be updated with security patches, new features, and bug fixes. 

Python 3

Python 3 was released in 2008. This version was created to rectify the fundamental Python 2’s flaws. Python 3 did away with duplicate modules and constructs that were in the previous Python versions.  The removal of duplicate tools with the introduction of Python 3 meant some of the code in Python 2 was incompatible with Python 3. Luckily, Python released 2to3, a tool that reviews and automatically converts Python 2 code to Python 3 syntax.  The introduction of this version attracted a big mass of the scientific community, such as those in neuroscience. The introduction of the NumPy library now posed Python as a competitor to Matlab and R and also accelerated its adoptions in data science and machine learning. At the time of writing, the current version of Python is Python 3.11.1.

Prerequisites to check the Python Version

You can access the terminal window/ terminal using these commands on Windows, Linux, and macOS, respectively; 

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

Since now you know that there are two major versions of Python, we can go ahead and learn how to check the version on our local machines.  Python 3 is backward incompatible. Python 2 and Python 3 are different pieces of software. It thus means that code written in Python 2 may not work as expected in Python 3.  When you check the Python version on your machine, the version will be represented in 3 sections separated by a dot. 

The major version The minor version The micro version

For instance, if we take the Python version, Python 3.8.10, 3 is the major version, 8 is the minor version, and 10 is the micro version. The last section of the Python version represents the latest updates and patches.  Python 3.7.1 is compatible with Python 3.8.10 as they belong to the same major version (3). However, Python 2.7 is not compatible with Python 3.8.

Check Python Version on Windows

Open Windows PowerShell using these steps; Win+R > type powershell > Enter/OK You can now go ahead and type this on the command line  python –version If Python is installed on your machine, the version will appear on the next line.

Check Python Version on Linux

Most modern Linux operating systems have Python pre-installed.  Use the Ctrl+Alt+T shortcut to open the command line on your Linux-based machine.  Use this command to print the Python version;  Or  The second command checks if Python 2 is installed If Python 3 is installed, you are likely to get something like this

Check Python Version on MacOS

You can quickly access your terminal in MacOS using this shortcut; Finder > Applications > Utilities > Terminal Use this command to check the Python version;  Or  The second command checks if Python 2 is installed If you have both Python 2 and 3 installed, you will get an output close to this

Check Python Version in the Script

It is important to check the Python version on your script when coding to avoid incompatibilities and crushes when you run the code.  Such a check is very important when you have more than one Python version on your PC.  Irrespective of whether you are using Windows, Linux, or macOS, you can use this command to check your script What happens if the same machine has two different versions of Python installed and you run the above-mentioned commands? Python 2 and Python 3 can run concurrently on your PC. The reason for this is that you may have some apps that are using Python 2 while others are created on Python 3.  To check whether the two Python versions are on your PC, use these commands;  Or  The second command checks if Python 2 is installed If both versions are present on macOS, you will get an output close to this screenshot

Conclusion

Python continues to power some of your favorite social media platforms, such as Instagram, entertainment sites, such as Spotify, and rides management platforms, such as Uber. If you need to create platforms creating similar or better platforms, Python should be one of your considerations.  You can now comfortably check the Python version irrespective of the operating systems you are using. Even though most are shifting to Python 3, you will still come across apps created on Python 2. The good news is that Python has various frameworks that you can use to create different applications.  You may also explore how to install Python 3 on CentOS, Ubuntu, and Windows.

How to Check Python Version in Windows  Linux  and macOS  2023  - 96How to Check Python Version in Windows  Linux  and macOS  2023  - 86How to Check Python Version in Windows  Linux  and macOS  2023  - 56How to Check Python Version in Windows  Linux  and macOS  2023  - 59How to Check Python Version in Windows  Linux  and macOS  2023  - 85How to Check Python Version in Windows  Linux  and macOS  2023  - 31How to Check Python Version in Windows  Linux  and macOS  2023  - 58How to Check Python Version in Windows  Linux  and macOS  2023  - 75How to Check Python Version in Windows  Linux  and macOS  2023  - 98How to Check Python Version in Windows  Linux  and macOS  2023  - 68