Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
Python

Virtual Environment in Python

Isolate project dependencies with venv so packages do not conflict globally.

Virtual Environment in Python — a practical guide to Python virtualenv venv with clear examples you can reuse in real projects.

Python Tutorial Series (36/95). Prefer one article? Read the complete Python tutorial.

Short description

Always create a virtual environment per project. Activate it before installing packages.

Steps

  1. Create .venv with python -m venv.
  2. Activate the environment.
  3. Install packages inside it only.

Create and activate venv

python -m venv .venv
# Windows PowerShell:
.venvScriptsActivate.ps1
# macOS/Linux:
# source .venv/bin/activate
pip install flask

Leave a reply

Your email address will not be published. Required fields are marked *