How Many Way To Check Python Version In Your Windows Linux Mac

How Many Way To Check Python Version In Your Windows/ Linux/ Mac?

Total
0
Shares

One of the most common questions related to Python that we get most often is, “Which version of Python do I have installed on my computer?” If you have the same question, too, you can check Python version on your computer with just a few simple steps. 

Furthermore, depending on the type of Operating System (OS), you have the steps of checking Python changes. However, you will only need to run a single command whether you own a Mac, Windows, or Linux computer. In this article, we will show you simple steps based on the Operating system you own. 

Why Are There Different Versions Of Python?

Why Are There Different Versions Of Python

Python is one of the most well-known programming languages, as it is really useful and easy to learn and code. The popularity of Python is due to the fact that it uses simple syntax when it comes to coding and programming. 

However, like every other programming language, the developers of Python come with newer Python versions with changing times and altering demands. You can check Python version on your computer in various ways, depending on the way that is more convenient for you.

What Does Python Look Like?

What Does Python Look Like

Before you check Python version present on your computer, you will need to understand what it looks like. In a Python version, there are three different numbers(values) of them separated by a dot. For example, the latest Python version is 3.11.1, which came out at the end of the year 2022.

Ways To Check Python Version Based On Operating Systems (OS)

Here are the ways in which you can check Python version as per the OS on your computer – Mac/ Linux/ Windows:

1. Check Python Version On Windows

Check Python Version On Windows

If you have a Windows OS on your computer, you can check version of Python library on it using the following steps:

  • Click ‘Start’ and type ‘cmd’ or ‘Windows PowerShell.’
  • If you type ‘cmd’ and you can click Command Prompt, a window will open with a black background.
  • If you type ‘Windows Powershell’ and click on it, you will be directed to a window with blue background.
  • On either of the two, enter 
python –version

If your computer has Python installed on it, it will return the Python version on the next line, in this case, 3.11.1.

In another way, you can just type ‘Python’ on the Start Menu of Windows, and it will return a Python version like “Python 3.11.1 (32-bit)”.

2. Check Python Version In MacOS

Check Python Version In MacOS

In mac OS, to know your Python version terminal is where you need to go. If you have Mac OS on your computer, you can check Python version by following the below-mentioned steps:

  • Click on the Launchpad icon on your Dock
  • Go to the Search Field, and type Terminal.
  • Click on the terminal, and a window will open.
  • In this case, use the command:
python –version

In this case, the terminal will return the Python version you have on your MacBook or Mac PC.

3. Check Python Version In Linux

Check Python Version In Linux

One of the best things about Linux is that in modern, updated Linux versions, Python comes preinstalled. To check Python version on your Linux computer, you need to go through the steps below:

  • Use the (CTRL+Alt+T) shortcut on your keyboard at the same time. 
  • The Linux Terminal will open.
  • On the terminal, type the command:
python –version

On the next line itself, the Linux Terminal will return the Python version, for example, “Python 3.11.1”.

Different Ways To Check Python Version On Different Places

Apart from checking your Python version, you might also need to know in detail the Python version you have on your computer. If you want to know about your Python module, your operating system, and other stuff, you need to consider the options given below:

1. How To Get Version Of Python Package?

How To Get Version Of Python Package

To do a Python module version check, you will need to use the “pip show” command on your Windows PowerShell/Command Prompt, Mac Terminal, or Linux Terminal. Here are the steps by which you can check Python library:

  • Go to Command Prompt/ PowerShell/ Terminal.
  • Suppose you want to look for a library named ‘xyz’. Use the below command:
  pip show xyz

After you have used the command, the name and version of the Python library will be mentioned in the next line.

2. How To Use The Python Check OS Option?

How To Use The Python Check OS Option

You can use the Python check OS option to get an idea of the OS version on your computer if you don’t know about it. You have to create a Python file, which you will run using a Python-supported IDE or command prompt.

Here is a program that will return the type of OS you have:

import sys
def get_platform():platforms= {‘linux1’ : ‘Linux’,‘linux2’ : ‘Linux’,‘darwin’ : ‘OS X’,‘win32’ : ‘Windows’}if sys.platform not in platforms:return sys.platform
return platforms[sys.platform]

Here, the get_platform() function will create a dictionary named ‘platforms’, consisting of OS values that gets returned by the sys.platform. However, if the function does not find sys.platform in the Python dictionary, it will return the value of Python itself. In this case, it will return a responsive name of the OS, as it finds in the ‘platforms’ dictionary.

3. How To Check Python Version In Jupyter?

How To Check Python Version In Jupyter

If you make use of a Jupyter notebook, you can easily check Python version in Jupyter by following the below-mentioned steps:

  • Open the Jupiter notebook.
  • Type the following command:
  !python -v

After you run the command on Jupyter notebook, it will return the Python version. For example, it will return “Python 3.11.1”. 

Conclusion

Hence, there are various ways through which you can check Python version on your computer. Depending on the Python version you have, you can always update it to the latest version. All you need to do is go to the Python.org website. There you will find the “Download Python” option, followed by the number that represents the latest version. Click on it and install it on your computer, and it will replace your existing version by updating it. Thereby, you can work using the latest Python version.

Have A Look :-

Total
0
Shares
Share 0
Tweet 0
Pin it 0
Share 0
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like