PythiloLesson 13 of 15 · progress kept in this browser

Virtual environments

Each project needs its own versions of its packages. A virtual environment is a folder with its own site-packages, sharing the interpreter and standard library of a base installation. python -m venv .venv creates one, and activating it puts .venv/bin first on your PATH.

import sys
import sysconfig

print(sys.prefix)
print(sys.base_prefix)
print("in a venv:",
      sys.prefix != sys.base_prefix)
print(sysconfig.get_path("purelib"))
Your task

Write venv_info(folder) returning None when folder has no pyvenv.cfg file, and otherwise a dict with the file's "home" and "version" values and "system_site_packages", a bool that is True only when include-system-site-packages is true, ignoring letter case. Lines look like key = value.