How to Check if Python Is Installed on Windows

Muhammad Waiz Khan Feb 02, 2024
  1. Use the py Command to Check if Python Is Installed on Windows
  2. Use the py --version Command to Check if Python Is Installed on Windows
  3. Use the where Command to Check if Python Is Installed on Windows
  4. Use Python IDLE to Check if Python Is Installed on Windows
  5. Use the Control Panel to Check if Python Is Installed on Windows
  6. Check Python Installation in Visual Studio Code
  7. Conclusion
How to Check if Python Is Installed on Windows

Python is one of the most popular programming languages in the world and can be installed on most operating systems, be it Mac, Linux, or Windows. The discussion for this article is restricted to only Windows devices, though.

Before diving into Python programming on a Windows system, it is essential to ensure that Python is properly installed. This tutorial will explore multiple ways to check if Python is installed on Windows.

Use the py Command to Check if Python Is Installed on Windows

When we execute the py command in the Windows Command Prompt, it first displays the details of the latest version installed on the computer and then runs/starts the installed version.

If we need to check if some version of Python, i.e., Python 2 or 3, is installed, we can do so using the following command.

For Python 2.x:

check if python is installed using py

For Python 3.7:

check if python is installed using py 2

If the specified version of Python is not installed, the command will first return the not found error and then return all the installed versions of Python by the py launcher.

check if python is installed - not found

And if the py launcher is not installed, the following error will be returned.

check if python is installed - not recognized

Use the py --version Command to Check if Python Is Installed on Windows

We can also check what version of Python 2 or 3 is installed using the following command.

check if python is installed using py version

The above command will return the latest version installed on the computer and will not start it. We can also check if some specific version of Python is installed in the following way.

check if python is installed using py version 2

It will return the latest version of Python 2 installed on the computer. If the Python version specified in the command is not installed, like the py command, it will return all the versions installed on the computer.

check if python is installed - not recognized

Use the where Command to Check if Python Is Installed on Windows

The Windows where command searches and displays files in a directory tree. This command searches for the given pattern in the current directory and the paths specified in the PATH environment variable.

The where command is handy for locating the multiple versions of the same command in the PATH environment variable. So, if we look for python using the where command, it will return the paths of all the copies of python.exe.

check if python is installed using where

The where command will return the following error if Python is not installed on the computer.

check if python is installed using where 2

Use Python IDLE to Check if Python Is Installed on Windows

Python IDLE (Integrated Development and Learning Environment) is a user-friendly Python shell that comes bundled with the Python installation package.

Follow these steps:

  • Open Python IDLE: Press the Windows key, type IDLE, and select the Python IDLE option from the search results.
  • Check Python Version: In the Python IDLE shell, click on the Help menu and select About IDLE. A window will appear, displaying the installed Python version.

    check if python is installed using idle

  • Verify Python Interpreter: In the Python IDLE shell, you can directly run Python code by typing print('Hello, World!') and pressing Enter. If Python is installed correctly, it will display Hello, World! as the output.

    check if python is installed using idle 2

Use the Control Panel to Check if Python Is Installed on Windows

Windows provides a convenient way to check installed programs through the Control Panel.

Follow these steps:

  • Open the Control Panel: Press the Windows key, type Control Panel, and select the Control Panel option from the search results.

    check if python is installed using control panel

  • check if python is installed using control panel 2

  • Locate Python: Look for Python or Python X.X in the list of installed programs. If Python is present, it means it is installed on your system.

    check if python is installed using control panel 3

Check Python Installation in Visual Studio Code

Visual Studio Code (VS Code) is a popular code editor that supports Python development. You can also check if Python is installed within the VS Code environment.

Follow these steps:

  • Launch the VS Code editor on your Windows system.
  • If you haven’t already, install the Python extension for Visual Studio Code by going to the Extensions view (Ctrl+Shift+X) and searching for Python.
  • With a Python file open in Visual Studio Code, click on the bottom left corner where it displays the selected interpreter. It will show the installed Python versions. If you see a valid Python interpreter, it indicates that Python is installed.

    check if python is installed using vscode

Conclusion

Ensuring the correct installation of Python is necessary before proceeding with the coding journey. This article provided a step-by-step guide on how to check if Python is installed using various methods, including the Command Prompt, Python IDLE, Control Panel, and Visual Studio Code.

By following these steps, you can confidently verify the presence of Python on your Windows machine, enabling you to harness the power of Python and embark on your coding journey.

Related Article - Python Installation