Skip to Content
Python Virtual Environments richtig nutzen
Warum virtuelle Umgebungen wichtig sind und wie man sie effektiv einsetzt.
December 26, 2025 by
Python Virtual Environments richtig nutzen
IT-Guy
python venv development

Using Python Virtual Environments the Right Way

Why virtual environments matter and how to use them effectively.

M
Martin Schmid
2025-12-28

The problem

Every Python developer knows the problem: project A needs Django 4.2, project B still needs Django 3.2. Without isolation this ends in chaos.

The solution: virtual environments

# Erstellen einer virtuellen Umgebung
$ python -m venv .venv

# Aktivieren
$ source .venv/bin/activate

# Pakete installieren
(.venv) $ pip install django==4.2

UV instead of pip

My tip: use uv instead of pip. It is 10-100x faster:

# Installation
$ pip install uv

# Pakete installieren
$ uv pip install -r requirements.txt

Best practices

  1. One environment per project - no global installations
  2. Maintain requirements.txt - always with versions
  3. .venv in .gitignore - never commit it to the repository
  4. Automate activation - e.g. with direnv

Clean environments = clean code!

Python Virtual Environments richtig nutzen
IT-Guy December 26, 2025
Archive
Welcome to the NerdThings Blog
The first post in the new blog about Shell, Python, AI and other nerd topics.