You don't need this to start the course โ Google Colab already covers you. This is for when you're ready to code on your own machine, in your own editor.
This topic walks through installing Python on your own computer and setting up Visual Studio Code as your editor, plus creating an isolated virtual environment (venv) per project. It's a natural next step once you're comfortable with the basics in Google Colab and want a proper local setup for bigger projects.
venv) is a private folder containing its own Python interpreter and package installs, separate from the rest of your system.pip is Python's package installer โ used to add libraries inside a virtual environment.python.org/downloads and download the latest stable version for your OS (Windows, macOS, or Linux).
python sometimes "isn't recognized" in the terminal afterward.
python3. You can install a newer version via a package manager instead of python.org if you prefer:
# macOS (Homebrew)
brew install python
# Ubuntu / Debian
sudo apt update
sudo apt install python3 python3-pip python3-venv
# Fedora
sudo dnf install python3 python3-pip
# Arch
sudo pacman -S python python-pip
python --version
# or, on some systems:
python3 --version
You should see something like Python 3.12.4.
code.visualstudio.com and download the installer for your OS, then install it like any other application.
Ctrl/Cmd + Shift + X), search for "Python" (by Microsoft), and click Install. This adds syntax highlighting, IntelliSense, debugging, and interpreter selection.
File โ Open Folder to open the folder where you'll keep your Python files โ VS Code works best when you open a folder rather than individual files.
A virtual environment keeps each project's installed packages separate, so different projects never conflict with each other's dependencies.
python3, not a plain python command โ use python3/pip3 below unless you've specifically aliased python. On Debian/Ubuntu, the venv module often isn't installed by default and creating one will fail with ensurepip is not available until you install it:# Debian / Ubuntu only โ install venv support first
sudo apt update
sudo apt install python3-venv python3-pip
# Inside your project folder, create the environment
# Linux / macOS
python3 -m venv venv
# Windows
python -m venv venv
# Activate it โ Linux / macOS
source venv/bin/activate
# Activate it โ Windows (Command Prompt)
venv\Scripts\activate
# Activate it โ Windows (PowerShell)
venv\Scripts\Activate.ps1
Once active, your terminal prompt will show (venv) at the start of the line โ that's your confirmation it worked. Once the venv is active, python and pip inside it both point to the venv's own Python 3, even on Linux โ so you only need python3/pip3 for the one-time setup commands outside the venv.
๐ก Tip: The folder namevenvis just a convention โ you can name it anything, butvenvor.venvare the most common choices and are usually already ignored by default.gitignoretemplates.
Once your virtual environment is created, tell VS Code to use it:
Ctrl/Cmd + Shift + P to open the command palette.venv folder (usually listed at the top as recommended).With your virtual environment active, pip (not pip3) already points to the venv's own pip on every OS, including Linux:
pip install requests
pip install numpy pandas
To save your project's dependencies so others (or future-you) can recreate the same environment:
# Save current packages to a file
pip freeze > requirements.txt
# Recreate the environment elsewhere from that file
pip install -r requirements.txt
Create a file named hello.py in your project folder:
print("Hello from my local Python setup!")
Run it from the VS Code terminal (with your venv active โ python works here on Linux too, since it now resolves to the venv's interpreter):
python hello.py
Hello from my local Python setup!
You can also click the โถ "Run Python File" button in the top-right corner of VS Code while the file is open.
python3/pip3 outside a venv (plain python often doesn't exist), and install python3-venv on Debian/Ubuntu before your first venv creation.requirements.txt is how you share/reproduce a project's exact dependencies.Install Python from python.org (checking "Add to PATH" on Windows), install VS Code plus its Python extension, then create a per-project virtual environment with python -m venv venv and activate it. Select that environment as your interpreter in VS Code, install packages with pip install, and run scripts with python filename.py. This local setup mirrors what Colab does for you automatically in the cloud โ useful once you're ready to work outside the browser, but not required to follow the rest of this course.