Installation & Running Python in Python

From the Python cheat sheet ยท Setup & Basics ยท verified Jul 2026

Installation & Running Python

Install Python and run scripts from the command line.

bash
# Install (macOS)
brew install python

# Install (Ubuntu/Debian)
sudo apt install python3 python3-pip

# Install (Windows) โ€” download from https://python.org/downloads

# Check version
python3 --version

# Run a script
python3 app.py

# Interactive REPL
python3
๐Ÿ’ก Use python3 explicitly โ€” "python" may point to Python 2 on some systems
โšก The REPL is great for testing snippets โ€” type exit() or Ctrl+D to quit
๐Ÿ“Œ On Windows, use "py" instead of "python3" as the launcher
๐ŸŸข Use "python3 -m" to run installed modules as scripts (e.g., http.server, venv)
installsetupcli

More Python tasks

Back to the full Python cheat sheet