Last active 1721225125

use to effect change in the universe

kristofer's Avatar kristofer revised this gist 1721132364. Go to revision

1 file changed, 1 insertion, 1 deletion

venv.md

@@ -1,4 +1,4 @@
1 - # Python venv virtual environment cheat sheet
1 + # Python3 venv virtual environment cheat sheet
2 2 ## Create a venv
3 3 To create a virtual environment, go to the root of your project and run
4 4

kristofer's Avatar kristofer revised this gist 1721132339. Go to revision

1 file changed, 18 insertions, 2 deletions

venv.md

@@ -7,7 +7,7 @@ To create a virtual environment, go to the root of your project and run
7 7 It will create a virtual environment called venv
8 8
9 9 ## Activate venv
10 - ``.\venv\Scripts\activate``
10 + ``.\venv\bin\activate``
11 11
12 12 ## Intall packages
13 13 ``pip install jupyter matplotlib numpy pandas scipy scikit-learn``
@@ -25,4 +25,20 @@ or
25 25 ## Install packages from requirements.txt
26 26 ``pip install -r requirements.txt``
27 27
28 - Place the ``requirements.txt`` file in the root of your project directory. When ready to install the dependencies, ensure your terminal is navigated to the project directory and your virtual environment is activated. Then, run ``pip install -r requirements.txt`` to install the listed packages within your virtual environment.
28 + Place the ``requirements.txt`` file in the root of your project directory.
29 + When ready to install the dependencies, ensure your terminal is navigated to the project directory
30 + and your virtual environment is activated. Then, run ``pip install -r requirements.txt``
31 + to install the listed packages within your virtual environment.
32 +
33 + ```bash
34 + python -m venv venv
35 + .\venv\bin\activate
36 + pip install -r requirements.txt
37 + ```
38 +
39 + __Also, more often lately (2023+), people have been suggesting your use `.venv` (note the dot).__
40 + Besure your `.gitignore` file has both `venv/` and `.venv/` in it.
41 +
42 +
43 +
44 +

kristofer's Avatar kristofer revised this gist 1721132205. Go to revision

1 file changed, 28 insertions

venv.md(file created)

@@ -0,0 +1,28 @@
1 + # Python venv virtual environment cheat sheet
2 + ## Create a venv
3 + To create a virtual environment, go to the root of your project and run
4 +
5 + ``python -m venv venv``
6 +
7 + It will create a virtual environment called venv
8 +
9 + ## Activate venv
10 + ``.\venv\Scripts\activate``
11 +
12 + ## Intall packages
13 + ``pip install jupyter matplotlib numpy pandas scipy scikit-learn``
14 +
15 + or
16 +
17 + ``python -m pip install -U jupyter matplotlib numpy pandas scipy scikit-learn``
18 +
19 + ## Create requirements.txt
20 + ``pip freeze > requirements.txt``
21 +
22 + ## Deactivate venv
23 + ``deactivate``
24 +
25 + ## Install packages from requirements.txt
26 + ``pip install -r requirements.txt``
27 +
28 + Place the ``requirements.txt`` file in the root of your project directory. When ready to install the dependencies, ensure your terminal is navigated to the project directory and your virtual environment is activated. Then, run ``pip install -r requirements.txt`` to install the listed packages within your virtual environment.
Newer Older