Introduction / Why This Is Needed
Python is one of the most popular programming languages in the world, used for web development, data analysis, machine learning, and automation. Installing Python on Windows is the first and essential step to start working with the language. This guide will walk you through installing the latest version of Python (3.12/3.13) with the correct environment variable (PATH) configuration, which will spare you from the common error "python is not recognized as an internal or external command". After completing these steps, you will be able to run Python scripts and install libraries via pip from anywhere in the command line.
Requirements / Preparation
Before you begin, ensure that:
- You have administrator rights on your computer.
- Windows 10 (build 1809 or higher) or Windows 11 is installed.
- You have sufficient free disk space (~100 MB).
- You are connected to the internet to download the installer and components (e.g., pip).
Step-by-Step Instructions
Step 1: Download the Official Python Installer
- Open your browser and go to the official website: https://www.python.org/downloads/
- The page will automatically highlight the latest stable version (e.g., Python 3.12.1 or 3.13.0).
- In the Windows download block, click the "Windows installer (64-bit)" link. If you have a very old 32-bit machine, select "Windows installer (32-bit)", but this is unlikely.
- Save the downloaded
.exefile (e.g.,python-3.12.1-amd64.exe) to a convenient folder, such asDownloads.
Step 2: Run the Installer with Administrator Privileges
- Navigate to the folder where you saved the installer.
- Right-click on the
python-*.exefile. - In the context menu, select "Run as administrator". This is necessary to write to system directories and configure PATH.
Step 3: Configure Installation Settings (The Most Important Step)
In the first installer window, pay attention to two key elements at the bottom:
- Check the box "Add Python to PATH". This is a mandatory step! Without it, the
pythoncommand will not be available in the command line. - Select the installation mode:
- "Install Now" (quick install): Installs Python to the default folder
C:\Users\YourUsername\AppData\Local\Programs\Python\Python312and includes all essential components, including pip and IDLE. Recommended for most users. - "Customize installation": Allows you to manually select components to install (e.g., documentation, pip, tcl/tk, test files) and change the install path. Choose this option if you know you don't need certain components.
💡 Tip: For a beginner, the optimal choice is "Install Now" with the "Add Python to PATH" box checked.
- "Install Now" (quick install): Installs Python to the default folder
- Click your chosen button and wait for the installation to complete.
Step 4: Disable Path Length Limit (Optional, but Recommended)
After a successful installation, in the final installer window you will see the option "Disable path length limit". Click on it.
⚠️ Important: This operation modifies the Windows registry and allows Python to work correctly with long file paths (over 260 characters), which is common in real-world projects. Without this, errors may occur when working with deeply nested folders.
Step 5: Verify the Installation
- Be sure to open a NEW command prompt (
cmd) or PowerShell window. The old window will not see the updated PATH. - Enter the command to check the Python version:
You should see something likepython --versionPython 3.12.1. - Enter the command to check the pip package manager:
You should see the path to pip and its version.pip --version - For an additional check, you can launch the Python interactive shell by simply typing
python. A>>>prompt will appear. To exit, pressCtrl+Z, thenEnter.
Verification of Results
A successful installation is confirmed if:
- The
python --versionandpip --versioncommands execute without errors and display current versions. - You can launch the Python interactive mode (
python). - You can install a third-party package, for example
pip install requests, without permission errors.
Potential Issues
Error "python is not recognized as an internal or external command..."
Cause: The PATH environment variable was not updated during installation. Solution:
- Reinstall Python, making absolutely sure to check the "Add Python to PATH" box on the first step of the installer.
- Or add the path manually:
- Find the folder where Python is installed (by default
C:\Users\YourUsername\AppData\Local\Programs\Python\Python312andC:\Users\YourUsername\AppData\Local\Programs\Python\Python312\Scripts). - Open Control Panel -> System -> Advanced system settings -> Environment Variables.
- In the "System variables" section, find the
Pathvariable, edit it, and add both these paths (each on a separate line). - Restart the command prompt.
- Find the folder where Python is installed (by default
Insufficient Permissions During Installation
Cause: The installer was run without administrator privileges. Solution: Close the installer, locate its file again, and run it "as administrator".
Conflict with Python from Microsoft Store
Cause: If you previously installed Python via the Microsoft Store, path conflicts may occur. Solution: Uninstall Python via "Apps & features" in Windows Settings, and then reinstall it from the official website by following this guide.