TensorLearn
Back to Course
Python Essentials: The Engineering Approach
Module 1 of 20

1. The Environment

Professional developers do not click icons. We command the machine.

1. The Terminal (Shell)

The terminal is not just a black box; it is a text-based interface to your Operating System's Kernel.

  • Kernel: The core of the OS that manages CPU, Memory, and Hardware.
  • Shell: The program (like zsh or bash) that takes your text commands and translates them into Kernel instructions.

Why do we use it?

GUIs (Graphical User Interfaces) are slow and limited. The Shell is fast, scriptable, and allows you to chain small tools together to build complex pipelines.

2. The Path Variable

When you type python, how does the computer know where it is? It looks at your PATH environment variable.

  • Definition: An ordered list of folders that the OS searches to find executables.
  • Visual: PATH = ["/usr/bin", "/usr/local/bin", "/opt/homebrew/bin"]

If python is in /opt/homebrew/bin, but that folder is not in your PATH, the command fails.

3. Installation Strategy

We avoid the System Python.

  • System Python: Installed by the OS (Mac/Linux) for its own needs. If you break it, your OS might crash.
  • User Python: Installed by us (via Homebrew/Conda) for development.

Mac Users (Homebrew)

Homebrew is the "Missing Package Manager for macOS". It installs software into its own directory (/opt/homebrew) and links it to your PATH.

bash
# 1. Install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # 2. Install Python brew install python@3.10

4. Verification

Prove that you are using the correct binary.

bash
which python3 # Should be: /opt/homebrew/bin/python3 (NOT /usr/bin/python3) python3 --version # Output: Python 3.10.x

Mark as Completed

TensorLearn - AI Engineering for Professionals