Ken Schaefer
4 months ago
commit
9f82b54241
2 changed files with 26 additions and 0 deletions
@ -0,0 +1,25 @@ |
|||||||
|
## Create virtual environment |
||||||
|
|
||||||
|
Open Terminal |
||||||
|
|
||||||
|
- Create a directory to hold your virtual environments, change into it |
||||||
|
- Create a virtual environment |
||||||
|
- `python -m venv {name-of-env}` Windows |
||||||
|
- `python3 -m venv {name}` Linux |
||||||
|
- Activate the virtual environment |
||||||
|
- `{name-of-env}\Scripts\activate.bat` Windows |
||||||
|
- `source {name}/bin/activate` Linux |
||||||
|
- Deactivate |
||||||
|
- `deactivate` |
||||||
|
- Install packages in the environment |
||||||
|
- `pip list` |
||||||
|
- `pip install requests` |
||||||
|
- Publishing an environment |
||||||
|
- `pip freeze > requirements.txt` |
||||||
|
- Using requirements |
||||||
|
- Create a new env |
||||||
|
- `pip install -r requirements.txt` |
||||||
|
- Best Practices |
||||||
|
- Create the project directory |
||||||
|
- Create the venv or env folder inside of the project directory |
||||||
|
- Source code does not go into the env folder |
Loading…
Reference in new issue