Python Programming · Foundations

Installing Python

Want it in plain words first? Jump to Eli explains — the same idea, no jargon.
On this page 9 sections
  1. In 30 seconds
  2. Why this matters
  3. The college version
  4. Eli explains
  5. Worked example
  6. Key takeaway
  7. Quick check
  8. Study tools
  9. Sources & references

In 30 seconds

Installing Python means obtaining a interpreter appropriate for your operating system, then confirming which interpreter your terminal will use. The command python3 --version checks a version, while sys.executable reveals the exact interpreter running code. For a project, python3 -m venv .venv creates a separate environment so that project-specific tools do not get mixed with other projects.

Why this matters

A computer can contain more than one , and a terminal command is only useful if you know which one it selects. Verifying the version and prevents a surprising number of setup problems before an assignment or project begins. Virtual environments add a second kind of clarity: they give one project its own Python context. That separation becomes valuable as soon as different projects need different third-party dependencies, even though dependency installation itself is a separate topic.

The college version

An installation is an interpreter, not just an icon

Python source code is carried out by a program called the Python interpreter. Installing Python therefore means placing an interpreter and its standard library on the machine in a way the operating system can find. The official documentation organizes setup separately for Windows, macOS, and Unix platforms because the native installation mechanisms and command discovery rules differ. Start from the official Python documentation or its linked download route for your platform rather than treating a command copied from another operating system as universal. On a managed computer, an instructor or organization may specify a supported installation method; follow that method when it exists. Keep a note of the installation route for future troubleshooting. This lesson deliberately stops at acquiring and identifying Python. Writing a script, working interactively, and installing third-party packages are later skills with their own failure modes. The goal here is a dependable interpreter selection: you should be able to state what program will run Python code and where it came from.

Verify the command your shell selects

After setup, check the interpreter before relying on it. On systems where the Python 3 command is named python3, run python3 --version. This asks that selected to print its version; it does not prove that every possible Python command on the machine refers to the same program. To inspect the exact executable from Python itself, use python3 -c 'import sys; print(sys.executable)'. The -c option supplies a one-line command to the interpreter, and sys.executable reports the absolute path of the executable running it. Together, these checks answer two distinct questions: which release is this, and which file supplied it? A result such as Python 3.12.x is not a promise about a class requirement; compare it with the version the course or project specifies. If a command is not found, do not guess by renaming random files. Return to the operating-system-specific setup guidance, or use the command name documented by the installation method you chose.

Why a project gets its own environment

A is a lightweight directory that represents an isolated Python context for one project. The standard library supplies venv to create one. From the project directory, python3 -m venv .venv creates an environment in a folder conventionally named .venv; the name is a convention, not a special keyword. The documentation describes an environment as having its own Python binary and site-packages directory. In practical terms, that lets a project keep its installed add-ons separate from another project's add-ons, without claiming that the project has installed a new programming language. The environment is based on a Python interpreter that already exists. This is a small but important distinction: first obtain a , then make a project environment from it. Do not delete or move an environment casually after configuring a project; recreate it with the intended interpreter if the project needs a fresh one.

Activation is a convenience, not the environment itself

Many setup guides tell you to activate an environment. Activation changes shell settings, chiefly PATH, so that typing python resolves to the environment's interpreter first. It is useful at an interactive terminal, but the environment exists even when it is not activated. A tool or automation can invoke its interpreter by its path instead. On macOS and Linux that interpreter is typically .venv/bin/python; on Windows it is typically .venv\Scripts\python.exe. The platform difference is exactly why blindly copying activation commands causes confusion. A direct, portable diagnostic is python -c 'import sys; print(sys.prefix != sys.base_prefix)' after the intended interpreter has been selected. In a venv, the documented comparison is true: sys.prefix points to the environment while sys.base_prefix refers to the base installation. This check verifies isolation without turning this lesson into a guide to using the REPL or installing packages.

Eli, the EliExplains learning guide

Eli explains

The same idea, in plain words

Explain it like I’m 10

Think of Python as a translator. You write Python instructions, but the computer needs the translator program—the interpreter—to carry them out. Installing Python puts that translator on your computer. Checking its version is like checking which edition of a dictionary you picked up: two editions can be similar but not identical. Checking its path tells you which physical copy you actually grabbed.

A virtual environment is a smaller workspace for one project. It starts with a real Python interpreter already installed, then gives the project its own labeled shelf for extra tools. That prevents one project's choices from quietly spilling into another's. You can activate the workspace so your terminal reaches it first, but the workspace is still there even if you point directly to its Python program.

Picture it like this

Imagine a building with several identical-looking toolboxes. python3 --version reads the model label on the toolbox you opened, and sys.executable tells you its storage location. A .venv is a project-specific toolbox beside the workbench.

Where the picture stops working

A virtual environment is not a sealed computer or a completely separate Python installation. It is a directory built from a base interpreter and it can still depend on operating-system details. The toolbox image also hides the fact that commands are selected by PATH rules, which can vary by shell and platform.

Worked example

A student has just installed Python and wants to prepare a course project without assuming which interpreter the terminal chose. First they run python3 --version; on the checked system it printed Python 3.9.6. Next they run python3 -c 'import sys; print(sys.executable)', which printed the full path of that interpreter. In the project folder, they create an environment with python3 -m venv .venv. To verify the new environment rather than merely trust the folder name, they invoke its Python and run import sys; print(sys.prefix != sys.base_prefix). The result is True, confirming that the process has a virtual-environment prefix distinct from its base prefix. They have verified interpreter selection and isolation without yet installing any package or writing a program.

Key takeaway

A reliable Python setup is one you can identify: obtain the interpreter through the appropriate platform route, verify its version and path, then create a separate venv when a project needs its own context.

Quick check

3 questions here, of 5 in this lesson’s practice set. Answers stay hidden until you check.

Question 1 of 3foundational

What does sys.executable report for a running Python process?

Choose an answer, then check it.
Question 2 of 3intermediate

A student has created .venv for a project. Which statement best distinguishes that directory from the original Python installation?

Choose an answer, then check it.
Question 3 of 3intermediate

After selecting the intended Python executable inside a virtual environment, which result is evidence that it is using that environment?

Choose an answer, then check it.
Practice all 5

Keep learning

Ready to build on this? Continue to the next lesson.

Practice this lesson
Study tools & related lessonsYou’ll learn to · Common mistakes · Easily confused · Key vocabulary · Related

You’ll learn to

  • Identify the platform-appropriate route for obtaining Python 3.
  • Verify an interpreter's version and executable path.
  • Distinguish an interpreter installation from a virtual environment.
  • Create an isolated project environment with the standard-library venv module.
  • Apply a check that confirms whether a Python process is using a virtual environment.

Common mistakes

  • Assuming every platform uses the same Python command.

    Use the command and installation route documented for the operating system and installation method; verify the selected executable afterward.

  • Treating a version check as proof of which file ran.

    Check both --version and sys.executable; version and executable path answer different questions.

  • Thinking a virtual environment replaces the base Python installation.

    Create a venv from an already available interpreter; it is a project-specific context, not the first step in obtaining Python.

  • Believing activation creates the environment.

    Activation changes shell command lookup. The environment is created by python3 -m venv .venv and can be used through its interpreter path.

Easily confused

Python installation vs. virtual environment

An installation supplies a base interpreter for the computer; a virtual environment is a project-specific context created from a base interpreter.

version check vs. executable-path check

--version reports the selected interpreter's release, while sys.executable identifies the actual executable file running the command.

creating a venv vs. activating a venv

Creation builds the environment directory; activation adjusts a shell so its interpreter is found first.

Key vocabulary

Python interpreter
The program that executes Python code and provides access to Python's standard library.
Python 3
The current major language line identified by version numbers beginning with 3.
executable
A file the operating system can run as a program; for Python, it is the interpreter program.
PATH
A shell or operating-system setting listing directories searched when a command is entered without a full path.
virtual environment
A lightweight, project-specific Python context with its own interpreter path and site-packages directory.
base interpreter
The existing Python installation from which a virtual environment is created.

Sources & references

  1. Setup and Usage — Python 3 documentation — Python Software Foundation
  2. Command line and environment — Python Documentation
  3. sys — System-specific parameters and functions — Python 3 documentation — Python Software Foundation
  4. venv — Creation of virtual environments — Python 3 documentation — Python Software Foundation

EliExplains lessons are original prose written from the open, credible references above. See Copyright & Licensing.

Researched 2026-08-19

Educational content only. It is not medical, legal or professional advice. Found an error? Tell us.