_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

Python Virtual Environments

02. 10. 2019 1 min read intermediate

Without virtual environment you share dependencies between projects. This leads to version conflicts and ‘works on my machine’.

venv — Built-in

python -m venv .venv source .venv/bin/activate # Linux/Mac .venv\Scripts\activate # Windows pip install -r requirements.txt deactivate

uv — Modern Alternative

Installation

curl -LsSf https://astral.sh/uv/install.sh | sh

Usage

uv venv uv pip install flask uv pip compile requirements.in -o requirements.txt

Best Practices

  • .venv in .gitignore
  • requirements.txt or pyproject.toml
  • Lock file (uv.lock, poetry.lock)
  • One env per project

Key Takeaway

Always use virtual environment. uv is faster than pip, poetry for complex projects.

pythonvenvvirtualenv
Share:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.