Need Assistance?

support@tutorialshub.in

Virtual Environments and Packages

pip package management

ADVERTISEMENT
Python Free Lesson
5 min read
ADVERTISEMENT

Why projects need isolated environments

A virtual environment gives a project its own installed packages. This prevents one application's dependency version from changing another application's behavior.

Create and activate an environment

The standard-library venv module can create an environment. Activation changes which Python and pip commands your shell resolves; the exact activation command depends on the operating system and shell.

What belongs in source control

Do not commit the environment directory itself. Commit the dependency metadata and source code so another developer or deployment system can recreate the environment.

Practice: create two projects with separate environments and install different versions of a harmless package to see how isolation works.

ADVERTISEMENT