0PricingLogin
Learn AI with Python · Lesson

Virtual Environments and pip

Create isolated environments with venv, install packages, manage requirements.txt.

Why Virtual Environments?

A virtual environment is an isolated Python installation for a single project. Each project gets its own set of packages, so upgrading NumPy for one project can never break another.

Without isolation, all packages install globally and version conflicts become unavoidable across data science projects.

Creating a venv

The built-in venv module creates an environment in a folder you name (commonly .venv).

Run this inside your project root. It creates a self-contained copy of the interpreter and a place for packages.

python -m venv .venv

All lessons in this course

  1. Virtual Environments and pip
  2. Jupyter Notebooks for Data Science
  3. Python Data Types for Data Science
  4. Working with the Python REPL and IPython
← Back to Learn AI with Python