1- .. _ virtualenv -heading:
1+ (virtualenv -heading)=
22
3- Virtualenv
4- =========================
3+ # Virtualenv
54
6- Why Use Virtualenv?
7- -------------------------
5+ ## Why Use Virtualenv?
86
9- You should use ` Virtualenv < https://virtualenv.pypa.io/en/latest/> ` _ because:
7+ You should use [ Virtualenv] ( https://virtualenv.pypa.io/en/latest/ ) because:
108
11- * It allows you to install multiple versions of the same dependency.
9+ - It allows you to install multiple versions of the same dependency.
10+ - If you have an operating system version of Python, it prevents you from changing its dependencies and potentially
11+ messing up your os.
1212
13- * If you have an operating system version of Python, it prevents you from changing its dependencies and potentially messing up your os.
13+ ## How to Use Virtualenv
1414
15- How to Use Virtualenv
16- -----------------------------
15+ Create your project folder, then a virtualenv within it:
1716
18- Create your project folder, then a virtualenv within it::
17+ ``` console
18+ $ mkdir myproject
19+ $ cd myproject
20+ $ python3 -m venv .venv
21+ ```
1922
20- $ mkdir myproject
21- $ cd myproject
22- $ python3 -m venv .venv
23+ Now, whenever you want to work on a project, you only have to activate the corresponding environment.
2324
24- Now, whenever you want to work on a project, you only have to activate the
25- corresponding environment.
2625
26+ ``` {eval-rst}
2727.. tabs::
2828
2929 .. group-tab:: OSX/Linux
@@ -39,16 +39,20 @@ corresponding environment.
3939
4040 > .venv\scripts\activate
4141 (venv) >
42-
42+ ```
4343
4444You are now using your virtualenv (notice how the prompt of your shell has changed to show the active environment).
4545
46- To install packages in the virtual environment::
46+ To install packages in the virtual environment:
4747
48- $ pip install click
48+ ``` console
49+ $ pip install click
50+ ```
4951
50- And if you want to stop using the virtualenv, use the following command::
52+ And if you want to stop using the virtualenv, use the following command:
5153
52- $ deactivate
54+ ``` console
55+ $ deactivate
56+ ```
5357
5458After doing this, the prompt of your shell should be as familiar as before.
0 commit comments