๐Ÿ“ฆ What You'll Install Today

By the end of this lesson, you'll have two things on your machine:

1. Python 3.12+ โ€” the actual Python runtime that executes your code. Think of it as the engine.

2. Visual Studio Code โ€” the text editor where you'll write code, with a Python extension to make editing easier. Think of it as the steering wheel and dashboard.

Together, they form your development environment โ€” the workspace where every Python program starts.

๐ŸŽฏ The 5 Steps (Quick Overview)

1. Download
python.org
Get Python installer for your OS
2. Install
Click โ†’ Next
Run installer, add to PATH
3. Verify
python --version
Check it worked
4. VS Code
code.visualstudio.com
Download and install editor
5. Extension
Python extension
Install Python support in VS Code

๐ŸŒ Meet Arjun & Aisha

๐Ÿ’ป
Hyderabad ยท Nairobi
Two Beginners, One Setup Journey

Arjun is in Hyderabad, buying his first laptop for a career switch into AI. He's never coded before but follows step-by-step tutorials.

Aisha is in Nairobi, using a second-hand machine her friend gave her. The OS is old, and she's worried about compatibility.

Both will follow this exact guide. By the end, both will type python --version and see Python 3.12.x. Then they'll create a file hello.py, run it from VS Code, and see their first program output. Let's do it.

2
Operating Systems
~20 min
Total Setup Time
1 file
You'll create

๐Ÿš€ Step-by-Step Installation

โฌ‡๏ธ Step 1: Download Python

Go to python.org โ€” the official Python website. Click the big yellow "Download" button. It auto-detects your OS.

You'll see a version like Python 3.12.7. That's fine โ€” any version 3.12 or higher works for this lesson. Download the installer (it's ~30 MB).

Note: If you're on an old Mac, you might get asked about Intel vs Apple Silicon. If your Mac was made after 2020, it's Apple Silicon. If older, it's Intel.

โš™๏ธ Step 2: Install Python (Windows / Mac / Linux)

Windows

Double-click the downloaded installer. A window opens. IMPORTANT: Check the box "Add Python to PATH" at the bottom left. This is critical โ€” it lets you type python in your terminal later.

Then click "Install Now". It takes 2โ€“3 minutes. You might see a "User Account Control" prompt โ€” click "Yes".

At the end, you might see an option to "Disable path length limit". Click it if it appears.

macOS

Double-click the installer. It opens a wizard. Click "Continue" through each screen. When asked, choose "Install for all users" (or just your user, both work). Enter your Mac password when prompted.

At the end, you might see a note about SSL certificates. Ignore it for now โ€” we'll come back to it if needed.

Linux (Ubuntu / Debian)

Open a terminal. Type this command:

Terminal โ–ถ Copy & paste

This uses your system's package manager to install Python. You'll be asked for your password (the sudo part). Type it and press Enter.

โœ… Step 3: Verify Installation

Open a new terminal or command prompt. Type this:

Terminal โ–ถ Expected output below

You should see output like Python 3.12.7 (or higher). pip is Python's package manager โ€” also essential. If you see this, Python is installed correctly.

# Expected output (your version number may differ) Python 3.12.7 Python 3.12.7 pip 24.0 from /usr/local/lib/python3.12/site-packages/python (python 3.12)

๐Ÿ’ป Step 4: Download & Install VS Code

Go to code.visualstudio.com. Click "Download". Pick your OS. The download is ~50 MB.

Once downloaded, install it like any other program โ€” click the installer and follow the prompts. It takes ~1 minute.

After installation, launch VS Code. You'll see a welcome screen.

๐Ÿ Step 5: Install the Python Extension

On the left sidebar of VS Code, you'll see a grid icon (Extensions). Click it. Search for "Python" โ€” the official one is by Microsoft. Click "Install".

This adds Python language support, code completion, debugging, and more to VS Code. Installation takes ~30 seconds.

VS Code may ask if you want to "Select Python Interpreter". If it does, click "Yes" and choose the version you just installed (e.g., Python 3.12).

โš™๏ธ Configuring VS Code (Quick Settings)

VS Code is usually auto-configured after the Python extension installs. But let's verify.

Open the Command Palette: Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac). Type Python: Select Interpreter. You should see your Python 3.12 version in the dropdown. Click it.

That's it! VS Code now knows where Python is on your machine.

Optionally, open Settings (Ctrl+, or Cmd+,) and search for "Format on Save". Toggle it on if you want VS Code to auto-format your code when you save files.

๐Ÿ“ Writing & Running Your First Script

Create a new folder somewhere on your computer โ€” call it python-practice. Open it in VS Code: File โ†’ Open Folder.

Right-click in the empty file explorer on the left and create a new file. Call it hello.py.

Type this code:

hello.py โ–ถ Your first program

Save the file (Ctrl+S or Cmd+S). Now run it. Click the play button (โ–ถ) in the top-right corner of the editor, or press Ctrl+F5.

You should see the output in a terminal at the bottom of VS Code:

# Terminal output Hello, I'm Arjun from Hyderabad I'm about to learn Python on Ramayai AI Academy!

Congratulations โ€” you just ran your first Python program from VS Code. This is the moment every programmer remembers.

โš ๏ธ Common Installation Errors & Fixes

Windows: "'python' is not recognized"

Problem: You type python --version in Command Prompt and get an error saying the command wasn't found.

Fix: Python wasn't added to PATH during install. Reinstall Python. When you reach the installer screen, check the "Add Python to PATH" checkbox before clicking "Install". Then restart your terminal and try again.

Alternatively, search "Environment Variables" on your Windows machine, edit the PATH variable, and add the folder where Python is installed (usually C:\Users\YourName\AppData\Local\Programs\Python\Python312).

Mac: SSL Certificate Error

Problem: When you try to pip install libraries later, you see an SSL error about certificates.

Fix: After the Python installer finishes on Mac, look in your Applications folder for "Python 3.12" โ†’ double-click the "Install Certificates.command" file. It's a one-click fix that handles SSL certificates.

Linux: Command Not Found or Permission Denied

Problem: python3.12 isn't in PATH, or pip fails with "Permission denied".

Fix: Use python3 instead of python โ€” that's the standard on Linux. If pip fails, run pip3 install --user package_name instead of sudo. The --user flag installs to your home directory without needing root access.

VS Code Doesn't Find Python

Problem: VS Code shows a red squiggly under Python code, saying "Pylance could not find Python".

Fix: Open the Command Palette (Ctrl+Shift+P), type "Select Interpreter", and manually choose your Python 3.12 installation from the list. If it's not there, click "Enter interpreter path..." and type the full path (e.g., /usr/bin/python3.12 on Linux or Mac).

๐ŸŽค Interview Questions

On most modern systems, python3 is the command to run Python 3.x, while python sometimes refers to the old Python 2.x (if it's even installed). Since Python 2 reached end-of-life in 2020, always use python3 on Mac/Linux to be safe. On Windows with the Python installer, python is fine.
PATH is an environment variable that tells your operating system where to find executable programs. When you "add Python to PATH", Windows (or Mac/Linux) can find the python command from any folder in your terminal. Without it, you'd have to type the full path to the Python executable every time.
The Python extension adds language features to VS Code: syntax highlighting (colors code), IntelliSense (autocomplete suggestions), debugging (step through code line by line), and linting (warnings about potential errors). VS Code is just a text editor โ€” the extension teaches it to speak Python.
pip stands for "Pip Installs Packages" (a recursive acronym!). It's Python's package manager. Once you've written a few scripts, you'll want to use libraries like NumPy, pandas, or Flask. You install them via pip, like pip install pandas. pip downloads the code from PyPI (Python Package Index) and installs it on your machine.
The installer puts Python files in a specific folder (e.g., C:\Python312). But your terminal doesn't automatically know where that is. By adding Python to PATH, the operating system checks that folder whenever you type a command. This lets you run python file.py from any terminal, any folder. Without PATH, your terminal would say "command not found". PATH is how the OS finds anything โ€” Python, git, npm, etc.

๐Ÿง  Quick Quiz

Question 1 of 5
Where do you download Python from?
Question 2 of 5
What does checking "Add Python to PATH" do during installation?
Question 3 of 5
What command verifies Python is installed correctly?
Question 4 of 5
What does the Python extension in VS Code do?
Question 5 of 5
On macOS, how do you fix the SSL certificate error when using pip later?
0
/5

๐Ÿ“‹ Installation Cheatsheet

Command / ActionWhat It Does
python --versionCheck your Python version
python3 --versionSame, on Mac/Linux (preferred)
pip --versionCheck pip (package manager) version
pip install pandasInstall a package (e.g., pandas)
code .Open current folder in VS Code
python hello.pyRun a .py file from terminal
Ctrl+Shift+POpen VS Code Command Palette (Windows/Linux)
Cmd+Shift+POpen VS Code Command Palette (Mac)
Ctrl+`Open/close terminal in VS Code
F5Run current file in VS Code debugger

โš ๏ธ Common Beginner Mistakes

"I installed Python but PATH isn't set"
You'll see "'python' is not recognized" errors. Reinstall Python and check the "Add to PATH" box during setup. Or manually add the Python folder to your PATH environment variable.
"I opened VS Code but it says 'Pylance: Pylint module not available'"
The Python extension is installed but not configured. Open the Command Palette (Ctrl+Shift+P), type "Python: Select Interpreter", and choose your Python 3.12 version. VS Code will initialize the environment.
"I tried to run a .py file but got SyntaxError from indentation"
Python is strict about indentation (spaces vs. tabs). Make sure you use 4 spaces for indentation, not tabs. If you copy code from the web, paste it carefully and re-indent if needed.
"I installed Python 3.9 but the tutorial says use 3.12+"
Python 3.9 is fine โ€” it works. The "+' just means 3.12 or any later version. Older versions (3.8, 3.7) are okay too for most tutorials, but 3.12 has the latest features. If you prefer, stick with what you have โ€” this lesson works on 3.9+.

โœฆ Key Takeaways

  • Download Python 3.12+ from python.org โ€” nowhere else
  • During Windows installation, check "Add Python to PATH" โ€” it's critical
  • Verify with python --version โ€” if it works, Python is installed
  • Download VS Code from code.visualstudio.com and install the official Python extension
  • Configure VS Code to find your Python via Command Palette โ†’ "Select Interpreter"
  • Create a .py file, type code, and press the play button to run it from VS Code
  • If PATH isn't set on Windows, reinstall Python and check the box โ€” or add it manually to Environment Variables
  • On Mac, if you see SSL errors later, run Install Certificates.command from the Python folder
Africa & India's Best AI Academy
๐Ÿค– AI-first ๐ŸŽ“ Placement Assistance

You've set up your first dev environment.
Now let's code.

Join the Best AI Program: The AI-Era Analyst โ€” 5 months, fully online, with placement assistance. Week 1 is free.

Explore The AI-Era Analyst โ†’