📘 Lesson 02 · Beginner

Python Installation & Setup

Step-by-step guide to install Python on Windows, macOS, and Linux, set up VS Code, and run your first script.

Download Python

Go to python.org/downloads and get the latest Python 3 installer for your OS. On Windows, run the installer and tick "Add Python to PATH" before clicking Install — this is critical, or Windows won't find Python from the terminal. On macOS use the .pkg installer or Homebrew (brew install python3). On Linux/Ubuntu run sudo apt install python3.

💡
Always install Python 3.10 or higher. Python 2 reached end-of-life in 2020 and is no longer maintained.

Verify the Installation

Open a terminal (Command Prompt on Windows, Terminal on Mac/Linux) and run this command. If it prints a version number, Python is ready:

terminal
python --version

# On some Mac/Linux systems you may need:
python3 --version
▶ Output
Python 3.12.0

The Interactive Shell (REPL)

Type python in your terminal to launch the REPL (Read-Eval-Print Loop). It runs code line by line and shows results instantly — perfect for quick experiments. The >>> prompt means Python is waiting. Type exit() to leave.

terminal
python

>>> print("Hello!")
Hello!
>>> 2 ** 10
1024
>>> exit()
▶ Output
Hello!
1024

Running a Script File

For real programs, save code in a .py file and run it from the terminal. This is how all Python programs are executed in practice:

hello.py
print("Python is running!")
print("Script works correctly.")
terminal
python hello.py
▶ Output
Python is running!
Script works correctly.

Installing Packages with pip

pip is Python's package manager. It downloads libraries from PyPI (Python Package Index), which hosts over 400,000 packages. Every third-party library you'll ever use — requests, flask, pandas, numpy — is installed this way:

terminal
# Install a package
pip install requests

# Install several at once
pip install flask pandas numpy

# See what's installed
pip list

# Remove a package
pip uninstall requests
▶ Output
Successfully installed requests-2.31.0
...
Package    Version
---------- -------
flask      3.0.0
pandas     2.1.0
Install VS Code with the Python extension — it gives you syntax highlighting, autocomplete (IntelliSense), and an integrated debugger.

🧠 Quick Check

Which command checks that Python is installed?

python -v
python --version
py version
check python

Tags

installationsetuppipvscodewindowsmaclinuxpython 3