androidengineers.Book a session

Python 01 · Start programming

Editor, terminal, virtual environments, and packages

articleSelf-paced

Learn the concept

A project should have its own dependency environment. Otherwise installing a package for one project can change another project’s behavior. From your project folder run python3 -m venv .venv. Activate it with source .venv/bin/activate on a Unix shell or the appropriate activation script under .venv\Scripts on Windows. Activation changes which interpreter your shell finds; it does not move your code.

Use python -m pip to install packages through the selected interpreter. Before diagnosing a missing package, inspect sys.executable; your editor and terminal may be running different interpreters. Keep the environment directory out of Git. Store dependency declarations in project metadata so another person can create a fresh environment.

The standard library is already included with Python. The examples in the core course mostly use it, so you can learn without an API key or a paid service.

Run and inspect

import sys
from pathlib import Path

print(sys.executable)
print(Path.cwd().name)

Your exercise

Create a virtual environment, configure your editor to use it, and compare the interpreter paths from the terminal and editor. Create a README containing the exact run command.

Check your understanding

Both executions use the intended environment. Your repository contains source and setup instructions, not the virtual environment itself.

YOUR LEARNING JOURNEY

0 of 119 available lessons completed

Progress saved in this browser. No account needed.
Editor, terminal, virtual environments, and packages | Forward Deployed Engineer | Android Engineers