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.
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:
python --version # On some Mac/Linux systems you may need: python3 --version
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.
python
>>> print("Hello!")
Hello!
>>> 2 ** 10
1024
>>> exit()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:
print("Python is running!") print("Script works correctly.")
python hello.py
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:
# 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
Successfully installed requests-2.31.0 ... Package Version ---------- ------- flask 3.0.0 pandas 2.1.0
🧠 Quick Check
Which command checks that Python is installed?