How To Know If Python Is Installed On Windows

Python is an incredibly popular programming language that’s widely used by developers across various domains. If you’re using a Windows computer, you may be wondering if Python is already installed on your system or if you need to download it. In this blog post, we’ll show you how to check if Python is installed on your Windows computer, and if not, how to install it.

A. Check if Python is Installed

There are several ways to check if Python is installed on your Windows computer:

1. Check using Command Prompt

Open the Command Prompt by pressing Win + R, type cmd and press Enter.

At the command prompt, type:

python --version

If Python is installed, you should see the version number. For example:

Python 3.9.2

If Python is not installed or the command is not recognized, you will see an error message like:

'python' is not recognized as an internal or external command,
operable program or batch file.

2. Check using Windows PowerShell

Open Windows PowerShell by pressing Win + X and selecting “Windows PowerShell” from the menu.

At the PowerShell prompt, type:

(Get-Command -Name "python").Source

If Python is installed, you should see the path to the Python executable. For example:

C:UsersYourUsernameAppDataLocalProgramsPythonPython39python.exe

If Python is not installed, you will see an error message like:

Get-Command : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program.

B. Install Python on Windows

If Python isn’t already installed on your Windows computer, you can download it from the official Python website:

  1. Visit the Python website at https://www.python.org/downloads/windows/ and download the latest version of Python for Windows.
  2. Run the downloaded installer file and follow the on-screen instructions to install Python. Make sure to check the “Add Python to PATH” option during the installation process.
  3. Once the installation is complete, open a new Command Prompt or PowerShell window and verify the installation by running python –version or (Get-Command -Name “python”).Source.

Now you should have Python installed and be able to check the Python version on your Windows computer. Happy coding!