Created
Sep 1, 2025 10:05 PM
Tags
Comprehensive Guide on python3 -m venv .venv
This guide covers all aspects of using Python's venv module, including installation, activation, deactivation, renaming the virtual environment, installing packages, and managing dependencies using requirements.txt.
‣
1. Installation of Python and venv
‣
2. Creating a Virtual Environment
‣
3. Activating the Virtual Environment
‣
4. Upgrade pip
‣
5. Install Packages
‣
5. Lock the exact versions requirements.txt
‣
6. Installing Packages from requirements.txt
‣
7. Deactivating the Virtual Environment
‣
8. Renaming the Virtual Environment
‣
9. Removing the Virtual Environment
Full Workflow Example
Here’s how the entire process might look:
Key Points
- Use
.venvas a convention for the environment folder. - Always activate the virtual environment before installing packages.
- Use
requirements.txtto manage dependencies for portability. - Deactivate the environment when not in use.
This ensures your projects are well-isolated and maintainable!