101 — Setting Up Python for DevOps

Beginner

Install Python 3.12 on macOS or Linux, create an isolated virtual environment, and confirm pip is ready — the foundation every DevOps automation script depends on.

Learning Objectives

1
Install Python 3.12 using the package manager for your OS
2
Understand why virtual environments matter for DevOps scripts
3
Create and activate a virtual environment with python3 -m venv
4
Verify pip is working inside the environment
5
Know how to deactivate and re-enter a virtual environment
Step 1

Check whether Python 3 is already installed

Before installing anything, check what Python version is already on your machine. Many Linux systems ship with Python 3 pre-installed, and macOS may have it via Homebrew or Xcode tools.

Commands to Run

python3 --version

What This Does

python3 --version prints the installed Python version.

If you see Python 3.10 or higher, your system already meets the minimum requirement.

If the command is not found or you see a version below 3.10, follow Step 2 (macOS) or Step 3 (Linux) to install a current version.

Expected Outcome

If Python is already installed: Python 3.12.x (or similar 3.10+ version).

If not found: command not found: python3.

Pro Tips

  • 1
    Python 3.10 is the minimum for this course. Python 3.12 is recommended.
  • 2
    Never run `python` without the `3` suffix — on many systems that still launches Python 2.
  • 3
    If you already have Python 3.10+, you can skip Steps 2 and 3 and jump to Step 4.
Was this step helpful?

All Steps (0 / 8 completed)