Configure Python on Linux
Configure Python on Linux
This page will walk you through installing Python and setting up your environment on Linux. Commands below use apt (Debian/Ubuntu). Adjust for your distribution (dnf, yum, pacman) as needed.
Installing Python
Most Linux distributions include Python 3, but it may not be the latest version.
sudo apt update
sudo apt install python3 python3-pip python3-venv -y
Verify:
python3 --version
pip3 --version
Installing VS Code
Option A: Snap
sudo snap install code --classic
Option B: .deb Package
Download the .deb from code.visualstudio.com and run:
sudo dpkg -i code_*.deb
Once open, install the Python extension (Ctrl+Shift+X → search Python → Install).
Creating the Course Folder
mkdir python-101
cd python-101
Setting Up a Virtual Environment
python3 -m venv .venv
source .venv/bin/activate
You should now see (.venv) in your terminal prompt.
You will need to run
source .venv/bin/activateeach time you open a new terminal. Grade 8 covers virtual environments in detail.
Verifying Your Setup
With your virtual environment active:
python --version
pip --version
Both should return version numbers. You are ready to start Grade 1.
Notes
- Once inside a virtual environment,
pythonandpipwork without the3suffix. - Some distributions may require
python3-fullinstead of justpython3-venv— check the error message ifvenvcreation fails.