Skip to main content / پرش به محتوای اصلی

How to Install Python on Windows: CMD, Winget & GUI (2026 Guide)

September 2026Updated: November 20265 min read۳۱ بازدید
How to install Python on Windows 11 and 10 step-by-step banner
Step-by-step guide to installing Python on Windows in 2026 using both the CLI (winget) and the official installer, configuring PATH, and running your first program.

If you are beginning your Python programming journey, your very first step is setting up Python on your Windows machine. If you are new to the language, you can start with our article on What is Python? Uses, Advantages, and Learning Path.

In this tutorial, you will learn two recommended installation methods: a fast command-line method using Windows Package Manager (winget) and the full graphical installer from the official Python website. By the end, Python will be configured in your environment, and you will run your first program.


Method 1: Installing Python via Command Line (winget)

The Command Line Interface (CLI) allows you to automate software installations directly from your terminal. Windows includes winget (Windows Package Manager), which downloads and installs the latest verified software without opening a browser.

1. Open Terminal / PowerShell

Press the Windows Key, type Terminal, and launch Windows Terminal or PowerShell.

Windows Start menu showing Terminal search

2. Check if Python is Already Installed

Run:

bash
python --version
  • If you see output like Python 3.14.x, Python is already installed.
  • If you see an error or the Microsoft Store window opens, proceed with the installation.

3. Install Python with winget

Search for available Python packages:

bash
winget search Python

Install the latest version using its exact package ID:

bash
winget install --id Python.Python.3.14 -e
  • --id Python.Python.3.14: Specifies the exact package ID.
  • -e (or --exact): Ensures winget selects the exact package match.

Accept the license prompt by pressing Y and Enter. Winget will automatically download and install Python.

4. Verify the Installation

Close your current terminal window and open a fresh Terminal window so the updated system PATH is loaded. Then run:

bash
python --version

Successful output of python --version command

5. Run Python Interactive Shell (REPL)

Type python to open the interactive Read-Eval-Print Loop (REPL):

bash
python

Test with a simple print statement:

python
>>> print("Hello, Python!")

To exit the shell, type exit() or press Ctrl+Z and Enter.

Output of print statement in Python interactive REPL


Method 2: Download Python from the Official Website

The official graphical installer provides full control over installation paths and optional features.

1. Visit the Official Python Download Page

Always download Python directly from the official source:

python.org/downloads

Official Python download page on python.org

2. Run the Installer

Launch the downloaded .exe installer (for example, python-3.14.x-amd64.exe).

3. Crucial Step: Check "Add python.exe to PATH"

On the very first screen of the installer, ensure the checkbox "Add python.exe to PATH" is checked at the bottom.

  • Why is PATH important? PATH tells Windows where to locate executable files. Checking this allows you to type python or pip from any directory in your terminal without specifying full file paths.

Add python.exe to PATH checkbox in Windows installer

4. Click "Install Now"

Click Install Now and allow administrator permissions when prompted.

At the end of the installation, click "Disable path length limit". This removes the traditional 260-character path limit on Windows, preventing issues with deeply nested Python virtual environments and packages.


Troubleshooting Common Setup Issues

1. "python is not recognized as an internal or external command"

  • Cause: Python was not added to the Windows environment PATH.
  • Fix: Re-run the installer, select Modify, click Next, and check Add Python to environment variables. Alternatively, add your Python install folder (e.g., C:\Users\<User>\AppData\Local\Programs\Python\Python314) to User PATH in Windows Environment Variables.

2. Running python Opens Microsoft Store

  • Cause: Windows has built-in App Execution Aliases redirecting uninstalled python.exe calls to the Store.
  • Fix: Open Windows Settings -> Apps -> Advanced app settings -> App execution aliases, and toggle off App Installer (python.exe) and App Installer (python3.exe).

Next Steps

Now that Python is successfully installed on your computer, you are ready to write software:

  1. Set Up a Code Editor: Download Visual Studio Code (VS Code) and install the official Python extension.
  2. Explore GUI Programming: Learn how to build graphical desktop apps with Tkinter in Python.
  3. Build a Desktop App: Build a Graphical Calculator with Python & Tkinter.
  4. Build a Telegram Bot: Follow our guide to Build a Modern Telegram Bot with Python.
  5. Learn Backend Engineering: Discover What is FastAPI and why it is ideal for Python backends.

Frequently Asked Questions

How do I install Python on Windows using CMD?

You can install Python directly from CMD or Windows Terminal using the built-in Windows Package Manager (winget). Simply open your terminal and run winget install --id Python.Python.3.14 -e. After installation completes, restart your terminal to reload system PATH variables.

What is the command to update Python with Winget?

To upgrade your installed Python version to the latest release, run winget upgrade Python.Python.3.14 -e in PowerShell or Command Prompt.

What is the difference between py and python on Windows?

py runs the Python Launcher for Windows, which automatically detects all installed Python versions on your computer and executes the newest one even if Python is not configured in your system PATH. python runs the specific binary mapped in your PATH environment variable.

Why does typing python in Windows open Microsoft Store?

Windows has default App Execution Aliases enabled that intercept python.exe calls and route them to the Windows Store if Python is missing from your PATH. You can turn this off in Windows Settings > Apps > Advanced app settings > App execution aliases.

Do I need to check "Add Python to PATH" during installation?

Yes, it is highly recommended. Adding Python to PATH allows you to run python, pip, and installed package tools from any directory or terminal in Windows without specifying absolute file paths.

Tags for this article:

Enjoyed this article?

Share it with your friends and colleagues.

Share: