Setting Up Your AI Dev Environment from Scratch
This was the first class I taught for NTU AI Club 114-2, built together with datafox.tw — a “survival kit” that gets someone who has never written a line of code to a working environment and a first running program in one evening.
I graduated in political science and only switched into software later, so I know exactly how off-putting “just getting the environment set up” can be for a beginner. That’s why this is written in painful detail — just follow along.
Why Python?
Pros
- Clean, intuitive syntax — close to English, beginner-friendly, fast to pick up.
- A complete ecosystem with easy package management; AI/ML, data analysis, and Web all have mature libraries.
- A huge community — rich resources on Stack Overflow and GitHub.
- Industry standard — Google, Meta, and OpenAI all use it heavily.
Things to note
- Slower (it’s interpreted — 10–100× slower than C/C++).
- The GIL (Global Interpreter Lock) limits multithreading.
- Loose typing can cause bugs in large projects.
But in AI/data work almost everything is Python, so none of this gets in the way of learning. Bottom line: for learning AI, Python is the best starting point right now.
What are an IDE and a Terminal?
Get these two terms straight first so the rest makes sense:
- IDE (Integrated Development Environment) — where you write code. It gives you syntax highlighting, autocomplete, a debugger, file management, Git integration, and usually a built-in terminal.
- Terminal — where you talk to the computer with text commands: run Python programs, install packages (
pip install), work with the file system. It’s “Terminal” on macOS and “CMD / PowerShell” on Windows.
Simple version: the IDE is where you write code, the terminal is where you run commands, and the terminal lives inside the IDE.
Recommended IDEs
- VS Code — free, classic, lightweight, tons of extensions.
- Antigravity — Google’s AI IDE (late 2025). It’s built on VS Code, so if you can use VS Code you can use it; it just adds a built-in Gemini AI Agent that can write code and run tests for you.
Installing Python
macOS
- Download the installer from python.org/downloads; or
- If you have Homebrew, just run
brew install python3.
Windows
Download the installer from python.org/downloads. Make sure you check “Add Python to PATH” during installation, otherwise the terminal won’t find python.
Verify it worked — open a terminal and run:
python3 --version # macOS
python --version # Windows
If you see a version number (e.g. Python 3.12.x), you’re good.
VS Code / Antigravity extensions
- Must-have:
Python,Jupyter. - Optional:
WakaTime(tracks your coding time — surprisingly motivating),Cline(a free AI coding assistant, a good fallback when your Gemini quota runs out),Rainbow CSV(read CSV files more clearly).
Package management: start with uv
pip is Python’s package manager — think “App Store for Python”. Common commands:
pip install requests # install a package
pip install requests==2.31.0 # pin a version
pip list # list installed packages
pip freeze > requirements.txt # export the list
pip install -r requirements.txt # install everything in the list
That said, I’d suggest beginners start with uv. Built by Astral (the team behind Ruff), it replaces pip + venv + pyenv in a single tool, installs packages 10–100× faster than pip, and manages virtual environments for you — saving you a pile of fiddly setup.
# Install uv
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
irm https://astral.sh/uv/install.ps1 | iex
# Create a project & add packages
uv init my-ai-project # new project, auto-generates pyproject.toml
cd my-ai-project
uv add requests # add a package, way faster than pip install
uv add google-genai # add the Gemini SDK
uv run python main.py # runs with the correct virtual env automatically
What are an API and an API Key?
Building anything with AI means using an API: your program “calls” someone else’s service (like Gemini) through it. And your API Key is your identity — anyone who gets it can call the service as you, which means spending your money.
A real case: someone pushed an API Key to GitHub and got billed US$55,000.
So whenever, wherever: never leak any of your API keys, and never put them in your code or push them to a public repo.
Getting a free Gemini API Key
Free, no credit card needed — a Google account is all it takes:
- Open Google AI Studio and sign in with your Google account.
- Accept the Terms of Service on first login.
- Click “Get API Key” on the left (or go straight to aistudio.google.com/apikey).
- Choose “Create API key in new project” — Google creates the Cloud project for you.
- Copy it and save it somewhere safe immediately. The key is a long string starting with
AIza.
For learning and small projects, the Free Tier is more than enough; if you go over the limit you’ll get a 429 (Rate Limit) error — just wait a moment and try again.
The most important part: key safety
Never hardcode your key:
api_key = "AIza..." # ← never do this
The right way is to use an environment variable, keep it in .env, and add .env to .gitignore so it’s never uploaded by git:
# in your terminal or shell config
export GEMINI_API_KEY="your-key"
.env
Today’s tasks
- Install Python and an IDE (VS Code or Antigravity).
- Get
Hello, World!to run. - Watch one recommended Python tutorial.
- (Optional) Get a Gemini API Key and use it to build a single-turn chatbot to test it out.
Once the environment’s up, the next step is syntax. I put that in a separate post: Python 101: The Syntax You Actually Need Before Your First AI Project.
Switching fields is genuinely hard — but once you clear “get the environment working”, you’ve already taken the toughest step. Questions welcome by email; I’m happy to chat.