mirror of
https://github.com/michivonah/python.git
synced 2025-12-22 20:46:29 +01:00
add commands for venv
This commit is contained in:
parent
16e41b0c1a
commit
da17646165
1 changed files with 34 additions and 0 deletions
34
basics/venv.md
Normal file
34
basics/venv.md
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
# Virtual python environments
|
||||||
|
|
||||||
|
## Advantages of venvs
|
||||||
|
- No mix of dependencies from different projects
|
||||||
|
- No mix up of system modules (macOS/Linux where Python comes preinstalled & is used by the OS)
|
||||||
|
|
||||||
|
## Create new python venv
|
||||||
|
macOS/Linux:
|
||||||
|
```shell
|
||||||
|
python3 -m venv venv/
|
||||||
|
```
|
||||||
|
|
||||||
|
Windows:
|
||||||
|
```shell
|
||||||
|
py -m venv venv\
|
||||||
|
```
|
||||||
|
|
||||||
|
## Activate venv
|
||||||
|
|
||||||
|
macOS/Linux:
|
||||||
|
```shell
|
||||||
|
source venv/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
|
Windows:
|
||||||
|
```shell
|
||||||
|
venv\Scripts\activate
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deactivate venv
|
||||||
|
All operating systems:
|
||||||
|
```shell
|
||||||
|
deactivate
|
||||||
|
```
|
||||||
Loading…
Add table
Add a link
Reference in a new issue