Select Page

How to install Python language on Windows


The easiest method to add Python to your environment variables is to add it during installation of the Python programming language. While installing, check the box Add Python to PATH at the bottom of the setup screen.


nanadwumor

September 03, 2023

Installing Python - adding Python to the environment variables


  • Type python –version in Command prompt to check Python version
  • You can add python manually to your PC environment variables

RECOMMENDED ARTICLES


Getting Started with Python
Getting Started with Python

Python is a versatile language that can be used for web development, data analysis, artificial intelligence, scientific computing, and much more. Ease of Learning Versatility Vibrant Community Abundance of Libraries RECOMMENDED ARTICLES...


Installing Python

Before you get started with Python, you need to have the Python language installed on your computer. In this article, we’ll guide you through the installation process on various operating systems. We will ensure that your Python environment is set up correctly to start coding. Are you ready? Hop on!

Windows does not have Python installed by default. You can check  if Python is installed on your Windows system by running one line of command on the Windows command prompt.

Open your command prompt by typing cmd at the Search input.

Select Command Prompt.

Windows command prompt
Windows command prompt

Test Presence of Python Installation

Type Python –version to test if Python is installed and included in your Windows Environment Variable.

If you jave not installed and added the Python application and Scripts to your Environment Variables, you will get the output that:

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

Windows Command Prompt - 'python' is not recognized as an internal or external command

Installing Python Language

The first step is to install the Python language at python.org

Method 1: Installing a Recent Version of Python

The easiest method to add Python to your environment variables is to add it during installation of the Python programming language. While installing, check the box Add Python to PATH at the bottom of the setup screen. This adds Python to your environment variables so that you can execute Python from the Command Prompt.

Installing Python - adding Python to the environment variables

continue through with the installation process. Python will be installed in your environment variable.

Method 2: Manually Adding Python to Windows Path

If you have installed previous version of Python or forgot to check the Add Python.exe to PATH , you can still add Python to your environment variables or Path.  We will navigate to the Windows Environment Variables screen (and add/edit our paths).

Follow the following steps.

Step 1: Press the Windows Key + R   on your keyboard in order to open the Run dialog box

Step 2: Type sysdm.cpl in the Run dialog box to open the System Properties dialogue box.

press sysdm.cpl in run dialog box

Alternatively, type Edit Environment Variables for your account to get straight to the Environment Variables dialogue box.

    Alternatively, you can also type the sysdm.cpl in the Search box.

    Step 3: Click the Advanced tab and then click on the ‘Environment Variables.

      system properties

      Step 4: Under the User variables box, click on ‘New…‘ to add the ‘Path’ variable

      NOTE: if you have the ‘Path’ variable already, then click on ‘Edit…’ instead. This gives you the chance to add your new Python path.

        Add New Environment Variable name and value

        The New User Variable box opens up for you to add/edit variable name and value.

          The relevant Python paths are the variable values. You need to copy these paths and paste in the variable value.

            (1) The Python application path, which is the folder where your Python files were stored during installation.

              Your Python files will likely be stored along this path.

              C:\Users\Username\AppData\Local\Programs\Python\Python311

              Note that username is the name of your computer. For example, if you have named your PC as villagecoder, your path will likely be:

              C:\Users\villagecoder\AppData\Local\Programs\Python\Python311\

              (2) The Python Scripts path. The folder which contains the Python Scripts  should be located within the Python application path.

              The Scripts path is along:

              C:\Users\villagecoder\AppData\Local\Programs\Python\Python311\Scripts\

              Press ‘OK’ to add the new Python Path under the ‘User variables‘ section. This adds Python to this User environment vriables.

              If you add it to the System Variables, Python becomes availabe for all users on the PC. That’s if your PC has multiple user logins.

              Don’t forget to press ‘OK‘ again so that the changes will get implemented.

              Test Presence of Python Again

              Open Command Prompt by typing cmd in the Search box.

              Type Python –version to test if Python is installed and included in your Windows Environment Variable.

              You should now see the Python version if you have properly followed instructions to install Python and set the variable environment. 

              python --version - add python to path

              What if I have followed Instructions to Set Python Path Yet I keep getting Error?

              If you type python –version and still get the error message that :

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

              It is likely App Installer shortcut launches the Windows Store when you attempt to run Python from Command Line Interface (CLI).

              Go to Settings>Application>App execution aliases or just type Manage App execution aliases in the Search box and press Enter.

              App execution aliases

              Turn the Python App Installers off. Python should now work fine on the Command Prompt.