Update venv detail
This commit is contained in:
parent
db8449fe68
commit
b6bc2e6661
@ -14,7 +14,41 @@ When a project is no longer needed, deleting its virtual environment is straight
|
|||||||
|
|
||||||
## How it works?
|
## 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`?
|
## Why I add `venv` on my `gitignore`?
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user