kristofer revidoval tento gist . Přejít na revizi
Žádné změny
kristofer revidoval tento gist . Přejít na revizi
1 file changed, 1 insertion, 1 deletion
venv.md
| @@ -1,4 +1,4 @@ | |||
| 1 | - | # Python3 venv Virtual Environment Fundamentals | |
| 1 | + | # Python3 Virtual Environment Fundamentals | |
| 2 | 2 | ||
| 3 | 3 | __Python Virtual Environments__ are a tool used to create isolated spaces on your computer where you can install | |
| 4 | 4 | and manage different versions of Python, as well as their respective packages, without affecting | |
kristofer revidoval tento gist . Přejít na revizi
1 file changed, 1 insertion, 1 deletion
venv.md
| @@ -54,7 +54,7 @@ or | |||
| 54 | 54 | ``pip install -r requirements.txt`` | |
| 55 | 55 | ||
| 56 | 56 | Place the ``requirements.txt`` file in the root of your project directory. | |
| 57 | - | When ready to install the dependencies, ensure your terminal is navigated to the project directory | |
| 57 | + | When ready to install the dependencies, ensure the current working directory (CWD) is the project directory | |
| 58 | 58 | and your virtual environment is activated. Then, run ``pip install -r requirements.txt`` | |
| 59 | 59 | to install the listed packages within your virtual environment. | |
| 60 | 60 | ||
kristofer revidoval tento gist . Přejít na revizi
1 file changed, 3 insertions, 3 deletions
venv.md
| @@ -22,7 +22,7 @@ To create a virtual environment, go to the root of your project and run | |||
| 22 | 22 | It will create a virtual environment called venv | |
| 23 | 23 | ||
| 24 | 24 | ## Activate venv | |
| 25 | - | `.\venv\bin\activate` | |
| 25 | + | `./venv/bin/activate` or `./.venv/bin/activate` | |
| 26 | 26 | ||
| 27 | 27 | Verify it is working with: | |
| 28 | 28 | ||
| @@ -32,7 +32,7 @@ Verify it is working with: | |||
| 32 | 32 | ||
| 33 | 33 | ## Intall packages | |
| 34 | 34 | ||
| 35 | - | Depending on what you're gonna do with the project. | |
| 35 | + | Depending on what you're gonna do with the project. Use `pip` to install packages. | |
| 36 | 36 | ||
| 37 | 37 | ``pip install jupyter matplotlib numpy pandas scipy scikit-learn`` | |
| 38 | 38 | ||
| @@ -60,7 +60,7 @@ to install the listed packages within your virtual environment. | |||
| 60 | 60 | ||
| 61 | 61 | ```bash | |
| 62 | 62 | python -m venv venv | |
| 63 | - | .\venv\bin\activate | |
| 63 | + | ./venv/bin/activate | |
| 64 | 64 | pip install -r requirements.txt | |
| 65 | 65 | ``` | |
| 66 | 66 | ||
kristofer revidoval tento gist . Přejít na revizi
Žádné změny
kristofer revidoval tento gist . Přejít na revizi
1 file changed, 15 insertions
venv.md
| @@ -1,4 +1,19 @@ | |||
| 1 | 1 | # Python3 venv Virtual Environment Fundamentals | |
| 2 | + | ||
| 3 | + | __Python Virtual Environments__ are a tool used to create isolated spaces on your computer where you can install | |
| 4 | + | and manage different versions of Python, as well as their respective packages, without affecting | |
| 5 | + | the global system installation. This isolation helps avoid version conflicts between projects that | |
| 6 | + | require different dependencies or libraries. | |
| 7 | + | ||
| 8 | + | Here's an in-depth look at how they work: | |
| 9 | + | ||
| 10 | + | ### Why Use Virtual Environments? | |
| 11 | + | ||
| 12 | + | - Isolation: Each virtual environment is independent of others, ensuring no interference occurs between projects with conflicting requirements. | |
| 13 | + | - Dependency Management: It allows you to manage dependencies for a specific project without affecting other projects or the system's Python installation. | |
| 14 | + | - Reproducibility: By using virtual environments, it becomes easier to replicate your development environment on another machine or share with others. | |
| 15 | + | - Safety: It prevents accidental modification of global packages and allows you to experiment without risking the system's Python installation. | |
| 16 | + | ||
| 2 | 17 | ## Create a venv | |
| 3 | 18 | To create a virtual environment, go to the root of your project and run | |
| 4 | 19 | ||
kristofer revidoval tento gist . Přejít na revizi
1 file changed, 1 insertion, 1 deletion
venv.md
| @@ -1,4 +1,4 @@ | |||
| 1 | - | # Python3 venv virtual environment cheat sheet | |
| 1 | + | # Python3 venv Virtual Environment Fundamentals | |
| 2 | 2 | ## Create a venv | |
| 3 | 3 | To create a virtual environment, go to the root of your project and run | |
| 4 | 4 | ||
kristofer revidoval tento gist . Přejít na revizi
1 file changed, 3 insertions
venv.md
| @@ -16,6 +16,9 @@ Verify it is working with: | |||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | 18 | ## Intall packages | |
| 19 | + | ||
| 20 | + | Depending on what you're gonna do with the project. | |
| 21 | + | ||
| 19 | 22 | ``pip install jupyter matplotlib numpy pandas scipy scikit-learn`` | |
| 20 | 23 | ||
| 21 | 24 | ``pip install Flask`` | |
kristofer revidoval tento gist . Přejít na revizi
1 file changed, 4 insertions
venv.md
| @@ -18,6 +18,10 @@ Verify it is working with: | |||
| 18 | 18 | ## Intall packages | |
| 19 | 19 | ``pip install jupyter matplotlib numpy pandas scipy scikit-learn`` | |
| 20 | 20 | ||
| 21 | + | ``pip install Flask`` | |
| 22 | + | ||
| 23 | + | ``pip install django`` | |
| 24 | + | ||
| 21 | 25 | or | |
| 22 | 26 | ||
| 23 | 27 | ``python -m pip install -U jupyter matplotlib numpy pandas scipy scikit-learn`` | |
kristofer revidoval tento gist . Přejít na revizi
1 file changed, 1 insertion, 1 deletion
venv.md
| @@ -11,7 +11,7 @@ It will create a virtual environment called venv | |||
| 11 | 11 | ||
| 12 | 12 | Verify it is working with: | |
| 13 | 13 | ||
| 14 | - | `which python` and it should be `"somwthing-something"/venv/bin/python` | |
| 14 | + | `which python` and it should be `"something-something"/venv/bin/python` | |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | ||