Windows guideUpdated October 2026•6 min read

How to install and run Python on Windows

Windows 10 and Windows 11 do not include Python by default. You can install Python through the official installer or the Windows Package Manager, and execute scripts using PowerShell or Windows Terminal.

Skip local Windows setup?
Execute scripts directly inside Microsoft Edge or Google Chrome with zero software installation.
Open browser runner

Step 1: Download and install Python on Windows

The Python Software Foundation publishes stable builds at python.org. For 64-bit Windows installations, download the Windows installer (64-bit) for Python 3.12.7.

Run the downloaded executable file named python-3.12.7-amd64.exe. On the first setup screen, select the checkbox labeled "Add python.exe to PATH" at the bottom of the dialog window. This setting registers the executable location in your Windows user environment variables.

Click "Install Now". On the final completion screen, click the option labeled "Disable path length limit" to remove the historic 260-character MAX_PATH limit in Windows.

Alternative installation: Windows Package Manager (winget)

Windows 11 and recent builds of Windows 10 include the winget package manager client. You can install Python directly from a command prompt without opening a web browser:

# Install Python 3.12 via winget
winget install Python.Python.3.12

Step 2: Verify installation in PowerShell

Close any existing terminal windows so Windows loads the updated PATH environment variables. Open PowerShell by pressing Windows Key + X and selecting "Terminal" or "Windows PowerShell".

Run the following commands to confirm that the CPython interpreter and pip package manager respond:

# Check interpreter version
python --version
# Expected output: Python 3.12.7
# Check pip package manager version
python -m pip --version

Windows also provides the official launcher executable py.exe installed in C:\Windows\py.exe. This launcher detects all installed Python versions on your computer:

# List all installed Python versions on Windows
py --list

Step 3: Create and run your first Python script

Create a dedicated directory for your code on your primary drive. Open PowerShell and create a directory named python-projects:

# Create workspace folder
mkdir C:\Users\kamlesh\python-projects
cd C:\Users\kamlesh\python-projects

Create a file named main.py using Windows Notepad or Visual Studio Code with the following program:

# Sample main.py script
import sys
user_name = input("Enter your name: ")
print(f"Hello, {user_name}! Python is running on {sys.platform}.")

Execute the file by passing its name to the python command in PowerShell:

python main.py

The script prompts for input and outputs the result in your terminal window before returning to the PowerShell command prompt.

Step 4: Set up virtual environments and install packages

Avoid installing third-party packages into the global Python root folder. Use the built-in venv module to create an isolated environment for each project.

Generate a local virtual environment named .venv inside your project directory:

# Create virtual environment
python -m venv .venv

Activate the environment by running the activation script:

# Activate environment in PowerShell
.\.venv\Scripts\Activate.ps1

If PowerShell displays an execution policy error such as PSSecurityException, configure script execution permissions for your current user account:

# Allow local scripts in PowerShell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Once activated, the command prompt displays (.venv). You can now install libraries from PyPI without administrator privileges:

# Install libraries with pip
pip install requests==2.31.0 numpy==1.26.4

Troubleshooting Windows execution errors

Three setup issues account for most execution problems on Windows machines.

Windows opens Microsoft Store instead of running Python

Windows 10 and 11 install zero-byte executable shims in %LOCALAPPDATA%\Microsoft\WindowsApps. When Python is not on your PATH, Windows redirects typing python to the Microsoft Store. To fix this, open Windows Settings, navigate to Apps > Advanced app settings > App execution aliases, and turn off the toggles for "App Installer python.exe" and "App Installer python3.exe".

Script window closes instantly when double-clicked

File Explorer executes .py files in a temporary Command Prompt session that terminates as soon as the script completes. Run your scripts from an open PowerShell prompt, or add input("Press Enter to finish...") as the final line of your file.

UnicodeEncodeError with UTF-8 characters

Legacy Windows consoles use code page 437 (CP437) or Windows-1252. To enable UTF-8 mode across all Python processes on Windows, set the environment variable PYTHONUTF8=1 in your user settings, or run chcp 65001 in your terminal session before execution.

Windows local CLI versus browser runner

Review the structural differences between desktop terminal execution and in-browser WebAssembly runners.

CapabilityWindows local terminalBrowser WebAssembly runner
Installation neededYes (python.org or winget)None (runs inside browser)
Path configurationRequires PATH setupZero path setup
System disk accessUnrestricted NTFS disk read/writeSandboxed virtual filesystem
Plot visualizationRequires desktop GUI window (Tk/Qt)Inline visual Plots tab with PNG export

Run Python scripts on Windows without installing software

Test Python 3.12 scripts, install PyPI packages, and inspect variables directly in Microsoft Edge or Google Chrome on Windows.

Launch Windows browser runner