最后活跃于 1775143183

use to effect change in the universe

kristofer's Avatar kristofer 修订了这个 Gist 1775143183. 跳至此修订

1 file changed, 11 insertions, 1 deletion

venv.md

@@ -24,7 +24,17 @@ _And at this point, you should do this in your Home Directory. That way you can
24 24 It will create a virtual environment called venv
25 25
26 26 ## Activate venv
27 - `./venv/bin/activate` or `./.venv/bin/activate`
27 + `source ./venv/bin/activate`
28 +
29 + and you can add it to your `.zprofile` by
30 +
31 + ```
32 + echo "source $HOME/venv/bin/activate" >> ~/.zprofile
33 + ```
34 +
35 +
36 +
37 +
28 38
29 39 Verify it is working with:
30 40

kristofer's Avatar kristofer 修订了这个 Gist 1775143087. 跳至此修订

1 file changed, 1 insertion

venv.md

@@ -18,6 +18,7 @@ Here's an in-depth look at how they work:
18 18 To create a virtual environment, go to the root of your project and run
19 19
20 20 _And at this point, you should do this in your Home Directory. That way you can add the `source` command to your .zprofile_
21 +
21 22 ``python -m venv venv``
22 23
23 24 It will create a virtual environment called venv

kristofer's Avatar kristofer 修订了这个 Gist 1775143069. 跳至此修订

1 file changed, 1 insertion

venv.md

@@ -17,6 +17,7 @@ Here's an in-depth look at how they work:
17 17 ## Create a venv
18 18 To create a virtual environment, go to the root of your project and run
19 19
20 + _And at this point, you should do this in your Home Directory. That way you can add the `source` command to your .zprofile_
20 21 ``python -m venv venv``
21 22
22 23 It will create a virtual environment called venv

kristofer's Avatar kristofer 修订了这个 Gist 1731506517. 跳至此修订

没有变更

kristofer's Avatar kristofer 修订了这个 Gist 1721225125. 跳至此修订

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's Avatar kristofer 修订了这个 Gist 1721137532. 跳至此修订

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's Avatar kristofer 修订了这个 Gist 1721137487. 跳至此修订

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's Avatar kristofer 修订了这个 Gist 1721133880. 跳至此修订

没有变更

kristofer's Avatar kristofer 修订了这个 Gist 1721133854. 跳至此修订

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's Avatar kristofer 修订了这个 Gist 1721132797. 跳至此修订

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
更新 更早