commands
// 2026-01-05
// ID: REF-Python-venv Command List
Python-venv Command List
Python Venv Command Guide
Venv creates isolated Python environments.
Top 10 Useful Commands
1. Create Env
python3 -m venv myenv
Explanation: Create 'myenv' folder.
2. Activate (Linux)
source myenv/bin/activate
Explanation: Enter the environment.
3. Activate (Windows)
myenv\Scripts\activate
Explanation: Enter on Windows.
4. Install Package
pip install requests
Explanation: Install into isolated env only.
5. Freeze
pip freeze > requirements.txt
Explanation: Save dependency list.
6. Install from File
pip install -r requirements.txt
Explanation: Restore dependencies.
7. Deactivate
deactivate
Explanation: Exit environment.
8. Check Path
which python
Explanation: Verify you are using the venv python.
9. Delete Env
rm -rf myenv/
Explanation: Delete the folder to remove env.
10. Upgrade Pip
pip install --upgrade pip
Explanation: Update pip inside env.
The Most Powerful Command
python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt
Explanation: The standard "bootstrapping" one-liner for any Python project.