⚙️ Setup

Python Installation — The Complete Setup Guide

A detailed, platform-by-platform walkthrough for installing Python correctly the first time — covering Windows, macOS, Linux, PATH configuration, virtual environments, and every common problem beginners run into along the way.

📅

Last Updated

March 2026

⏱️

Read Time

22 min

🎯

Level

Beginner

Why Installation Deserves More Attention Than It Gets

Installing Python is often treated as a five-minute afterthought — something to rush through on the way to the 'real' learning. In practice, this is exactly where a lot of beginners quietly sabotage their own progress. A missed checkbox during setup, a confusing system Python already sitting on the machine, or a PATH variable that never got updated can turn what should be a two-minute install into hours of frustrated searching for why python simply refuses to run.

This guide takes installation seriously. It walks through Windows, macOS, and Linux individually, explains what each installer option actually does, shows you how to verify everything worked, and covers the handful of problems that trip up almost everyone at some point. By the end, you won't just have Python installed — you'll understand exactly what got installed and why.

Python is unusual among programming languages in how little setup it demands. There's no separate compiler to configure, no build toolchain to wire together, no IDE license to activate. A single installer from python.org gives you the interpreter that runs your code, the pip package manager that installs libraries, and IDLE, a basic code editor — all in one download. That simplicity is exactly why the few things that can go wrong tend to catch people off guard, because installation is 'supposed to be easy' and beginners rarely double-check the details.

It also helps to understand, even briefly, what you're actually installing. Python as a language is really just a specification — a set of rules for syntax and behaviour. What you download from python.org is CPython, the official reference implementation, written in C, that turns your .py files into running programs. Every command you type — python, pip, python -m venv — is really you talking to this CPython installation. Keeping that mental model in mind makes troubleshooting far more intuitive later.

What You Need Before You Start

You don't need much. A computer running a reasonably current version of Windows, macOS, or Linux, an internet connection to download the installer, and about ten minutes of uninterrupted attention are enough. You do not need any prior programming knowledge, and you do not need to buy anything — Python is completely free and open source under the Python Software Foundation's license.

One decision worth making upfront is which version to install. As of 2026, Python 3.12 is the version most commonly recommended for both learners and production projects, thanks to its strong balance of stability, performance, and broad library support. Python 3.13 and 3.14 are newer, bringing experimental features like free-threaded execution — which removes Python's long-standing Global Interpreter Lock limitation — and early JIT compilation support. These are exciting, but not always the safest default if you want maximum compatibility with third-party packages. Unless you have a specific reason to chase the newest release, start with 3.12 and upgrade later once you're comfortable.

VersionRecommended ForWhy
Python 3.12Most beginners & production useBest balance of stability, performance, and library support
Python 3.13Developers exploring new featuresFree-threaded mode and JIT preview, though some packages may lag in support
Python 3.14Current stable releaseContinued performance work; safe once your key libraries confirm support
Python 3.10 or olderMaintaining legacy projects onlyMissing newer syntax and performance improvements; avoid for new work
Python 2.xNobodyEnd-of-life since January 2020 — do not install for new projects

Installing Python on Windows

Windows does not ship with Python pre-installed, which actually works in your favour — there's no confusing 'system Python' to accidentally interfere with. You're starting from a clean slate.

  • Step 1 — Go to python.org/downloads and click the yellow 'Download Python 3.12.x' button; it auto-detects your OS.

  • Step 2 — Run the downloaded .exe file. On the very first screen, tick the box labelled 'Add python.exe to PATH' at the bottom — this is the step almost everyone forgets, and the source of most beginner installation problems.

  • Step 3 — Click 'Install Now' for the default setup, which installs Python into a per-user folder and handles everything automatically, or 'Customize installation' if you want to change the install location or disable optional features like the documentation.

  • Step 4 — Toward the end of installation, click 'Disable path length limit' if prompted. Windows historically limited file paths to 260 characters, and nested project folders with layered dependencies can hit that limit unexpectedly.

  • Step 5 — Open Command Prompt (search 'cmd' in the Start menu) and type python --version to confirm the installation succeeded.

🪟 Command Promptverify-install.bat
C:\Users\you> python --version
Python 3.12.4

C:\Users\you> pip --version
pip 24.0 from C:\...\site-packages\pip (python 3.12)

That single checkbox — 'Add python.exe to PATH' — is responsible for the vast majority of 'python is not recognized' errors reported by beginners. PATH is a system variable that tells Windows which folders to search through when you type a command in the terminal. If Python's installation folder isn't listed there, typing python does nothing useful, because Windows has no idea where to look for it.

Installing Python on macOS

macOS installation involves one extra wrinkle Windows users don't face: macOS already includes a system version of Python, used internally by the operating system for its own scripts and tools. This is not the Python you should develop with, and it's important to keep the two separate. Modifying or installing packages into the system Python can interfere with OS-level functionality, and Apple can silently change or remove that version during system updates without warning.

Option A — Official Installer

  • Download the macOS .pkg installer from python.org/downloads

  • Open the .pkg file and follow the installation wizard — it installs into /usr/local, entirely separate from Apple's system copy

  • Verify with python3 --version in Terminal — note the 3. On macOS, the plain python command has historically pointed toward the legacy Python 2 interpreter Apple bundled for years, so official installers register the command as python3 specifically

Option B — Homebrew (Preferred by Many Developers)

🍏 Terminalinstall-homebrew-python.sh
# Install Homebrew first if you don't already have it
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Then install Python
brew install python

# Verify
python3 --version

Homebrew handles the download, installation, and linking automatically, and — crucially — makes future upgrades far simpler. When a new Python version is released, updating is as easy as running brew upgrade python, rather than manually downloading a fresh installer each time. For this reason, many working developers prefer Homebrew even though the official installer works perfectly well too.

Installing Python on Linux

If you're on Linux, there's a good chance Python 3 is already sitting on your system, since many distributions rely on it for internal tooling. Before installing anything, check:

🐧 Terminalcheck-and-install.sh
# Check if Python 3 is already installed
python3 --version

# Debian / Ubuntu
sudo apt update
sudo apt install python3 python3-pip python3-venv

# Fedora
sudo dnf install python3 python3-pip

# Arch Linux
sudo pacman -S python python-pip

A detail worth flagging specifically for Debian and Ubuntu users: the python3-venv package is sometimes not installed by default alongside the base Python package. Since you'll want to create isolated project environments almost immediately after installing, it's worth explicitly including it in your install command rather than discovering it's missing later, mid-project.

Choosing an Editor to Write Your Code In

Installing the interpreter is only half the picture — you also need somewhere to actually write your Python files. The good news is that every Python installation already includes IDLE, a lightweight built-in editor with no setup required at all. It's genuinely fine for your first week or two of learning, especially for short scripts and following along with tutorials.

ToolBest ForLearning CurveNotes
IDLEAbsolute first stepsNoneShips free with every Python install
VS CodeEveryday codingLowLightweight, hugely popular, great Python extension
PyCharm CommunityLarger, structured projectsMediumFuller IDE, more setup overhead and resource usage
Jupyter NotebookData science, interactive learningLowGreat for experimenting cell by cell
Online editors (Replit, etc.)Quick practice, no installNoneGood for trying code before installing anything locally

As your projects grow, most developers eventually move to Visual Studio Code, a free, lightweight editor with an excellent official Python extension adding autocomplete, inline error detection, and integrated debugging. For larger projects, PyCharm Community Edition offers a fuller integrated development environment at the cost of a steeper learning curve. There's no wrong choice — start with whatever feels least intimidating, and switch once you notice yourself wanting features your current setup doesn't offer.

Verifying That Everything Actually Works

Regardless of platform, a genuinely successful installation should pass four simple checks. Open your terminal or command prompt and run each of these in turn:

🖥️ Terminalpost-install-checks.sh
python --version        # or python3 --version on macOS/Linux
pip --version           # or pip3 --version
python -c "print('Python is working')"
python -m venv --help

The first two confirm that the interpreter and package manager are correctly installed and reachable from any folder. The third is a tiny sanity check that Python can actually execute code, not just report a version number. The fourth confirms that the built-in venv module — which you'll rely on constantly once you start building real projects — is available. If all four produce sensible output rather than errors, your setup is genuinely complete, not just superficially installed.

Setting Up Your First Virtual Environment

Right after installing Python, before you install a single third-party package, it's worth building the habit of working inside a virtual environment. A virtual environment is a self-contained, isolated copy of Python for a specific project — its own space for installed packages that doesn't touch your global Python installation or interfere with any other project on your machine.

This matters more than it might initially seem. Imagine two projects: one needing an older version of a web framework, and another needing the newest release of the same framework. Without isolation, installing one would break the other. Virtual environments solve this by giving every project its own private set of dependencies.

🖥️ Terminalfirst-venv.sh
mkdir my-first-project
cd my-first-project

python -m venv .venv

# Windows:
.venv\Scripts\activate

# macOS / Linux:
source .venv/bin/activate

# Your prompt should now show (.venv) at the start

Once activated, any pip install command only affects this project's environment, not your global Python installation. Run deactivate at any time to exit back to your normal terminal. This one habit — a fresh virtual environment for every new project — is arguably the single most valuable practice you can adopt early, preventing the vast majority of 'it worked yesterday but not today' dependency headaches.

A Note on Manually Editing PATH

Occasionally you'll want to add Python to PATH manually rather than relying on the installer's checkbox — for instance, if you installed Python without noticing that option, or you're setting up a second version alongside an existing one. On Windows, this is done through Settings → System → About → Advanced system settings → Environment Variables. Under 'User variables,' find the entry named Path, select it, and click Edit. From there you can add a new entry pointing to your Python installation folder, and a second entry for the Scripts subfolder inside it, which is where pip and other command-line tools actually live. After saving, close and reopen any terminal windows, since PATH changes only take effect in new sessions.

On macOS and Linux, PATH is typically managed through a shell configuration file rather than a graphical settings panel — commonly ~/.zshrc, ~/.bash_profile, or ~/.bashrc, depending on which shell you're using. Adding a line like export PATH="/usr/local/bin/python3:$PATH" and reloading the file with source ~/.zshrc achieves the same effect as the Windows steps above. Most beginners never need to touch this manually, since both the official installer and Homebrew configure PATH correctly on their own — but knowing how to do it by hand is useful once you start managing multiple language versions.

Single Global Install vs. Version Managers

As you grow more comfortable with Python, you may eventually outgrow the simple 'one interpreter per machine' setup described throughout this guide. Developers who regularly switch between multiple Python versions across different projects often adopt a version manager instead of installing each version separately by hand. Tools like pyenv on macOS and Linux, or the built-in py launcher on Windows, let you install several Python versions side by side and switch between them per project with a single command, rather than manually managing PATH entries or reinstalling software each time a project's requirements change.

For a beginner working through their first tutorials, this is genuinely more complexity than you need right now — a single, correctly installed Python version is more than sufficient for months of learning. But it's worth knowing this path exists, so that when you eventually find yourself juggling an older legacy project alongside a brand-new one requiring the latest release, you know the problem has a well-established solution rather than something to work around awkwardly.

Fixing the Problems Everyone Runs Into

Even with careful installation, a handful of issues show up often enough that they're worth knowing about in advance, rather than discovering them cold and panicking.

ProblemLikely CauseFix
'python' is not recognized (Windows)Add to PATH checkbox was skipped during installReinstall and tick 'Add python.exe to PATH', or manually add the install folder to your System PATH variable
python opens Microsoft Store instead of runningWindows App Execution Alias is intercepting the commandTurn off the Python aliases in Settings → Apps → Advanced app settings → App execution aliases
'python' works but 'pip' doesn'tpip wasn't included, or PATH is missing the Scripts folderRun python -m pip --version instead, or reinstall with pip included
Wrong version shows after installMultiple Python versions installed, older one is first in PATHUse py -0 on Windows to list versions, or adjust PATH order manually
Permission denied on macOS/LinuxTrying to install packages into system Python without a virtual environmentAlways create and activate a virtual environment before installing packages

On macOS and Linux specifically, if you hit a permission denied error while installing a package, resist the urge to simply add sudo in front of the command. That often 'fixes' the immediate error while quietly installing the package into a system-level location you didn't intend, causing conflicts later. The better fix, almost always, is to create and activate a virtual environment first, then run your install command inside it.

Upgrading or Uninstalling Python

Eventually you'll want to move to a newer Python version, and it's useful to know that installing a new version does not automatically remove the old one — multiple Python versions can, and often do, coexist peacefully on the same machine. On Windows and macOS, running a new installer typically gives you the choice to install alongside the existing version or replace it outright.

  • Windows — Uninstall via Settings → Apps → search 'Python' → Uninstall, then reinstall the version you want

  • macOS (official installer) — Remove the corresponding folder in /Library/Frameworks/Python.framework and update symlinks in /usr/local/bin

  • macOS (Homebrew) — Run brew uninstall python, then brew install python@3.12 for a specific version

  • Linux — Use your package manager's remove command, e.g. sudo apt remove python3.11

Before removing an older version, it's worth checking whether any existing project's virtual environment was built against that specific interpreter — deleting the underlying Python it depends on can quietly break that environment, even if the project's files themselves remain untouched.

Interview Questions on Python Setup & Environments

Practice Questions — Test Your Setup Knowledge

1. You typed 'python --version' and got 'python is not recognized as an internal or external command'. What are two possible fixes?

Easy

2. What command creates a virtual environment named .venv in the current folder?

Easy

3. Why might 'python --version' and 'python3 --version' return different results on the same machine?

Medium

4. On Linux, after installing python3, 'pip3 install requests' fails with a permissions error. What is the recommended fix rather than using sudo?

Medium

5. What is one practical reason a developer might choose pyenv over a single global Python install?

Hard

Conclusion — You're Fully Set Up

At this point, you have a working, correctly configured Python installation — not just a version number printed in a terminal, but a genuine understanding of what's installed, why the setup steps matter, and how to fix things if they go sideways. You've also created your first virtual environment, which puts you in the same working habits that professional developers rely on daily, right from your very first project.

None of this needs to be memorised perfectly. What matters is that you now know where to look when something doesn't behave as expected, and that you understand the reasoning behind each step rather than having followed it blindly. From here, the natural next step is learning how Python actually stores and manipulates data — starting with variables, the built-in data types, and the small rules that govern how you name and use them throughout your code.

Frequently Asked Questions (FAQ)