DEV Community

John Ajera
John Ajera

Posted on

Install Python on Windows via CLI (winget)

Install Python on Windows via CLI (winget)

Setting up Python on Windows no longer requires clicking through installers — thanks to winget, Microsoft’s official Windows Package Manager.

Here’s how you can install Python 3 in seconds, entirely from the terminal.


1. Open PowerShell

Press Win + X → select Windows PowerShell (Admin) or Terminal (Admin).


2. Find Available Python Versions

First, list all available Python packages:

winget search Python.Python 
Enter fullscreen mode Exit fullscreen mode

You’ll see results like:

Name Id Version ---------------------------------------- Python 3.13 Python.Python.3.13 3.13.7 Python 3.12 Python.Python.3.12 3.12.10 Python 3.11 Python.Python.3.11 3.11.9 ... 
Enter fullscreen mode Exit fullscreen mode

Pick the latest version (e.g. 3.13) and install it:

winget install -e --id Python.Python.3.13 
Enter fullscreen mode Exit fullscreen mode

If you want an older version (e.g. 3.12), just replace the ID.

⚠️ The meta-package Python.Python.3 isn’t always available — searching first ensures you install a version that exists in your winget catalog.


3. Reopen Your CLI (Important!)

After installation, close and reopen PowerShell or Terminal. This refreshes the PATH so that python and pip are recognized.

Then verify the installation:

python --version pip --version 
Enter fullscreen mode Exit fullscreen mode

If python still opens the Microsoft Store, go to Settings → Apps → Advanced app settings → App execution aliases and turn OFF python.exe and python3.exe (they conflict with real Python installs).


4. (Optional) Upgrade pip

Keep pip up to date:

python -m pip install --upgrade pip 
Enter fullscreen mode Exit fullscreen mode

Why Use winget?

✅ Official (maintained by Microsoft + Python Software Foundation)

✅ Adds Python to PATH automatically (just reopen your terminal to apply)

✅ Fully scriptable (great for automation & CI)

✅ Reproducible setup for fresh machines


That’s it — you’ve installed Python on Windows with a single command, and it’s ready to use after reopening your terminal.

Top comments (0)