tags:
- python
- virtualenv
title: What is a virtual environment?
permalink: what-is-python-virtualenv
A virtual environment has its own installation of Python and libraries, keeping dependencies separate from other projects.
Create a virtual environment if one doesn't exist.
[[ -d ".venv" ]] || python -m venv .venv
Activate it.
. .venv/bin/activate
Upgrade pip.
pip install --upgrade pip
Poetry automatically creates and activates virtual environments.