RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Fredoline Eruo
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
  1. >
  2. Home
  3. /Learn
  4. /Courses
  5. /Python for AI — Zero to Useful
  6. /Ch. 2
Python for AI — Zero to Useful

02. Your Environment

Chapter 2 of 36 · 20 min
KEY INSIGHT

Your Python environment is isolated per project. Never run `pip install` globally unless you understand system-level dependencies. Use virtual environments from day one.

What You Need

For this course, you need:

  • Python 3.12 or newer
  • A text editor (VS Code, Neovim, Zed, anything that saves plain text)
  • A terminal (bash, zsh, PowerShell)

That is it. Do not install JupyterLab, Docker, or anything else yet. You need to understand plain Python first.

Installing Python

macOS and Linux

Your system likely has Python 3 already. Check:

python3 --version

If you see 3.12.x or higher, you are set. If not, use a package manager:

# macOS with Homebrew
brew install [email protected]

# Ubuntu/Debian
sudo apt update
sudo apt install python3.12

Windows

Download the installer from python.org/downloads. During installation, check "Add Python to PATH". Open Command Prompt or PowerShell and verify:

python --version

Your First Script

Create a file called hello.py:

print("Hello, AI")

Run it:

python3 hello.py

If you see "Hello, AI", your environment works.

Virtual Environments (Why They Matter)

Every project needs its own environment. This prevents version conflicts between projects.

# Create a virtual environment
python3 -m venv myproject

# Activate it
# macOS/Linux:
source myproject/bin/activate
# Windows:
myproject\Scripts\activate

# Now install packages only for this project
pip install numpy

When activated, your terminal shows (myproject) prefix. Packages you install go into this isolated environment.

Installing NumPy and Pandas

For chapters 10 onward, you need NumPy and Pandas:

pip install numpy pandas requests

Verify installation:

import numpy as np
import pandas as pd
print(f"NumPy {np.__version__}, Pandas {pd.__version__}")
EXERCISE
  1. Create a directory for this course
  2. Create a virtual environment inside it
  3. Activate it
  4. Run pip install numpy pandas requests
  5. Create a test script that imports all three and prints their versions
← Chapter 1
Why Python for AI?
Chapter 3 →
Variables and Types