From b6bc2e6661624e20b7ae54649595726d254b00d1 Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Sun, 4 Jan 2026 22:16:42 +0700 Subject: [PATCH] Update venv detail --- pages/requirement/venv.md | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/pages/requirement/venv.md b/pages/requirement/venv.md index 30365f9..84a12f6 100644 --- a/pages/requirement/venv.md +++ b/pages/requirement/venv.md @@ -14,7 +14,41 @@ When a project is no longer needed, deleting its virtual environment is straight ## How it works? -When you run `python3 -m venv your_venv_directory_name`, Python creates a directory for “A mini Python install just for this project”. When you activate it with `source .venv/bin/activate`, your shell is told "When I type `python` or `pip`, use the ones inside `.venv`", Nothing else changes. So, when you type `pip install requests`, it installs only inside `.venv`. Then, you can deactivate venv with `deactivate` command. +When you run: + +```sh +python3 -m venv your_venv_directory_name +``` + +Python creates a directory for *“A mini Python install just for this project”*. + +When you activate it with + +```sh +source your_venv_directory_name/bin/activate +``` + +You should see + +```sh +(your_venv_directory_name) +``` + +your shell is told *"When I type `python` or [pip](pages/requirement/pip.md), use the ones inside `your_venv_directory_name`"*, Nothing else changes. + +So, when you type: + +```sh +pip install requests +``` + +it installs only inside `your_venv_directory_name`. + +Then, you can deactivate venv with this command: + +```sh +deactivate +``` ## Why I add `venv` on my `gitignore`?