Python Development Environment on Windows

Blog / Python · January 31, 2016 · Updated June 10, 2026 · 9 min read
Python Development Environment on Windows

To set up a modern Python development environment on Windows in 2026, install Python 3.13 (the latest stable release) with winget install Python.Python.3.13 or the official installer from python.org, then use the bundled py launcher to pick versions and create virtual environments with venv. For Django, FastAPI, and most server-side Python, the smoothest path is to install WSL2 (Ubuntu) and develop inside Linux while editing in VS Code with the Python and Pylance extensions. Use venv (or the faster uv) for per-project isolation, and pip with a requirements.txt or pyproject.toml to track dependencies.

Key takeaways

  • Install Python 3.13 via winget install Python.Python.3.13, the official python.org installer, or the Microsoft Store — and always tick "Add python.exe to PATH" if you use the installer.
  • Use the py launcher (py -3.13, py -m venv .venv) to choose interpreters and run scripts — it ships with the official installer and resolves version conflicts cleanly.
  • WSL2 (Ubuntu) is the best modern path for Django/FastAPI work on Windows: native Linux tooling, no compiler or path headaches, and parity with production servers.
  • VS Code + the Python and Pylance extensions is the dominant editor setup; it auto-detects your virtual environment and works seamlessly with WSL2.
  • venv is the default for isolation; uv is a fast, modern alternative (installer, resolver, and venv in one), with Poetry and pipenv as project-management options.
  • Skip Python 2 entirely — it reached end of life in 2020. Everything here targets Python 3.13 (with 3.12 a safe, widely-supported fallback).

How do I install Python 3.13 on Windows?

You have three good options in 2026 — pick one:

  1. winget (recommended for most): Windows' built-in package manager installs Python and registers the py launcher in a single command. Easy to script and to update later.
  2. Official installer (python.org): Download the 64-bit installer and, on the first screen, check "Add python.exe to PATH" before clicking Install Now. This is the most reliable way to get the py launcher with full control over options.
  3. Microsoft Store: Search "Python 3.13" and install. Great for quick starts and locked-down machines, but it sandboxes file access, which can complicate some tooling — prefer winget or the official installer for serious development.

Verify the install from a new PowerShell window with py --version and py -3.13 --version. If python isn't recognised, you skipped the PATH step — re-run the installer and tick the box, or just use the py launcher, which works regardless of PATH.

Python 3.13 is the latest stable release; 3.12 is an equally safe choice if a dependency hasn't published 3.13 wheels yet.

# Install the latest stable Python with winget (Windows Package Manager)
winget install Python.Python.3.13

# ...or pin Python 3.12 if a dependency lacks 3.13 wheels
winget install Python.Python.3.12

# Verify from a NEW terminal (the py launcher is installed system-wide)
py --version
py -3.13 --version

# Upgrade later
winget upgrade Python.Python.3.13

What is the py launcher and why should you use it?

The py launcher is a small Windows utility (installed with the official installer and with winget) that finds and runs the right Python for you. Instead of juggling PATH entries or full interpreter paths, you call py and tell it which version you want. It is the recommended way to run Python on Windows because it lets multiple versions coexist painlessly.

Common commands:

  • py — launch the newest installed Python
  • py -3.12 — launch a specific version
  • py -m venv .venv — create a virtual environment with a chosen interpreter
  • py -m pip install <package> — run pip for the selected version

Using py -m <module> (rather than calling pip or venv directly) guarantees the command runs against the interpreter you intend — the single best habit for avoiding "it works in one terminal but not another" confusion.

# Run the newest installed Python
py

# Run a specific version
py -3.12

# List every Python the launcher can see
py --list

# Always invoke tools through the interpreter you mean:
py -3.13 -m pip install requests
py -3.13 -m venv .venv

Should you use native Windows, WSL2, or Docker Desktop?

For most server-side Python — Django, FastAPI, data work, anything that touches Linux in production — develop inside WSL2 (Windows Subsystem for Linux) running Ubuntu. You get native Linux tooling, fast package installs, no MSVC build-tools pain when a package needs to compile, and an environment that matches your deployment target. Native Windows is fine for scripting, GUI apps, and learning; Docker Desktop shines when you need to mirror a multi-service production stack exactly.

Factor Native Windows WSL2 (Ubuntu) Docker Desktop
Setup effort Lowest Low (wsl --install) Medium
Linux / production parity Poor Excellent Excellent
C-extension / compiler pain Common Rare Rare
Filesystem speed Native Fast (keep code in the Linux FS) Good
VS Code integration Native Excellent (Remote - WSL) Excellent (Dev Containers)
Best for Scripts, GUI apps, learning Django/FastAPI, most web dev Reproducible multi-service stacks

Install WSL2 with a single command in an administrator PowerShell, reboot, then create your Ubuntu user. Keep your project files inside the Linux filesystem (e.g. ~/code), not under /mnt/c/..., for the best performance.

# In an ADMINISTRATOR PowerShell -- installs WSL2 + Ubuntu, then reboot
wsl --install

# After reboot, list and update distros
wsl --list --verbose
wsl --update

# Inside Ubuntu: Python 3 is preinstalled; add venv + pip + build tools
sudo apt update
sudo apt install -y python3 python3-venv python3-pip build-essential

# Open the current Linux folder in VS Code (Remote - WSL)
code .

How do I set up VS Code for Python?

Visual Studio Code is the dominant Python editor in 2026, and it is free. Install it with winget install Microsoft.VisualStudioCode, then add two extensions from Microsoft:

  • Python — debugging, environment selection, test running, and an interactive REPL.
  • Pylance — fast IntelliSense, type checking, and auto-imports (powered by Pyright).

After opening a project, press Ctrl+Shift+PPython: Select Interpreter and choose your virtual environment (VS Code auto-detects a .venv in the project root). If you use WSL2, install the Remote - WSL extension and click Open a Remote Window so the editor runs against your Linux toolchain.

Prefer a keyboard-driven, terminal-based workflow instead? A tuned Vim or Neovim setup is a strong alternative — see our guide to Vim and Neovim for Python development.

How do I create and manage virtual environments?

Always isolate each project in its own virtual environment so dependencies never collide. The built-in venv module is the default recommendation — it ships with Python and needs no extra install. Create one per project, activate it, and install packages into it.

For larger projects you may want more: uv is a fast, modern installer and resolver (written in Rust) that creates environments and installs dependencies dramatically faster than pip, while Poetry and pipenv add lockfiles and project-management workflows around pyproject.toml.

Tool What it does Use it when
venv + pip Built-in isolation + installs Default; nothing to install, works everywhere
uv Ultra-fast installs, resolver, venv, Python install You want speed and a modern all-in-one CLI
Poetry Dependencies + packaging via pyproject.toml + lockfile Libraries/apps that need reproducible locks
pipenv Pipfile + lockfile workflow Teams already standardised on it

Avoid the legacy virtualenvwrapper-win as your primary tool — venv, uv, or py -m venv cover its use cases on modern Windows.

# --- Built-in venv (PowerShell) ---
py -m venv .venv                  # create
.\.venv\Scripts\Activate.ps1      # activate (PowerShell)
# If activation is blocked, allow local scripts for your user once:
#   Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
deactivate                        # leave the environment

# --- Same thing inside WSL2 / Ubuntu (bash) ---
python3 -m venv .venv
source .venv/bin/activate

# --- Modern alternative: uv (fast installer + resolver) ---
# Install uv on Windows:  winget install astral-sh.uv
uv venv                           # create .venv
uv pip install django             # install into it, blazing fast

pip basics: requirements.txt vs pyproject.toml

With an environment active, pip installs packages from PyPI. Record what you install so collaborators (and future you) can rebuild the environment exactly.

  • requirements.txt — a simple, one-line-per-package list. Generate it with pip freeze > requirements.txt and reinstall with pip install -r requirements.txt. Perfect for applications and quick projects.
  • pyproject.toml — the modern standard that declares dependencies (plus build and packaging metadata) in one file. It is what Poetry, uv, and pip install . read, and it is the right choice for libraries and longer-lived projects.

A practical rule: start with venv + requirements.txt, and graduate to pyproject.toml (with uv or Poetry handling a lockfile) once the project grows or you need reproducible builds.

# Inside an activated environment
py -m pip install --upgrade pip           # keep pip current
py -m pip install django requests         # install packages

# Freeze exact versions for an application
py -m pip freeze > requirements.txt
py -m pip install -r requirements.txt     # rebuild elsewhere

# Inspect what's installed
py -m pip list

How do I manage multiple Python versions on Windows?

If you only need a couple of official releases, the py launcher already handles it — install 3.12 and 3.13 side by side and select with py -3.12 / py -3.13. For finer control (installing, switching, and pinning many versions per project), use one of:

  • uv — can install and pin Python versions as well as manage environments (uv python install 3.13).
  • pyenv-win — a Windows port of pyenv that downloads and switches between many versions, with a per-directory .python-version file.

For most Windows developers, py plus uv covers the need; reach for pyenv-win when you must juggle several minor versions across projects.

# Install pyenv-win (PowerShell), then restart the terminal so PATH updates
winget install pyenv-win.pyenv-win

# List, install, and pin versions
pyenv install 3.13.1
pyenv install 3.12.7
pyenv global 3.13.1               # default everywhere
pyenv local 3.12.7               # pin THIS project (writes .python-version)

# Or let uv manage versions instead:
uv python install 3.13
uv python pin 3.13

Frequently Asked Questions

What Python version should I install on Windows in 2026?

Install Python 3.13, the latest stable release, for new projects. If a dependency hasn't published 3.13-compatible wheels yet, 3.12 is a safe, widely-supported fallback. Avoid Python 2 entirely — it reached end of life on 1 January 2020 and receives no updates or security fixes.

Do I need WSL2 to develop Python on Windows?

No, but it is strongly recommended for web and server-side work. WSL2 (Ubuntu) gives you native Linux tooling, faster package installs, and parity with the Linux servers you deploy to — avoiding Windows-specific path and compiler issues. Native Windows is perfectly fine for scripting, automation, and GUI apps.

Why isn't python recognised in my terminal?

The interpreter isn't on your PATH. Either re-run the official installer and tick "Add python.exe to PATH", or simply use the py launcher (py --version, py -m pip ...), which works regardless of PATH. Always open a new terminal after installing so PATH changes take effect.

Should I use venv, uv, or Poetry?

Start with the built-in venv — it needs no extra install and works everywhere. Switch to uv when you want much faster installs and an all-in-one CLI, or Poetry when you need lockfiles and packaging metadata in pyproject.toml. All three create isolated, per-project environments.

How do I fix "running scripts is disabled" when activating a venv in PowerShell?

PowerShell's execution policy is blocking the activation script. Run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once to allow locally-created scripts, then activate with .\.venv\Scripts\Activate.ps1. Alternatively, activate from Command Prompt with .\.venv\Scripts\activate.bat.

What's the difference between requirements.txt and pyproject.toml?

requirements.txt is a flat list of pinned packages, ideal for applications — create it with pip freeze. pyproject.toml is the modern standard that declares dependencies plus build and packaging metadata, and is read by pip, uv, and Poetry. Use requirements.txt for quick apps and pyproject.toml for libraries or longer-lived projects.

Build faster with the right Python foundation

A clean Windows setup is just the starting line — the real wins come from solid architecture, testing, and shipping. MicroPyramid has built and maintained Python applications since 2014, across 50+ projects in Django, FastAPI, and AI-powered features. Once your environment is ready, see which Python web framework fits your project and walk through creating your first Django app. When you want a team that ships in days to weeks, explore our Python development services.

Share this article