Skip to content

Commit 2d540c4

Browse files
committed
✏️ Use .venv
1 parent 6bb9d84 commit 2d540c4

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

docs/libs/install.rst

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,26 @@ virtual environments, so that different applications can use different versions
4848
of Python and its packages. Creating and using a virtual environment is a
4949
two-step process:
5050

51-
#. First, we create the environment:
51+
#. First we create a project directory and then the virtual environment in it:
5252

5353
.. tab:: Linux/macOS
5454

5555
.. code-block:: console
5656
57-
$ python3 -m venv myenv
57+
$ mkdir myproj
58+
$ cd myproj
59+
$ python3 -m venv .venv
5860
5961
.. tab:: Windows
6062

6163
.. code-block:: ps1
6264
63-
> py -m venv myenv
65+
> mkdir myproj
66+
> cd myproj
67+
> py -m venv .venv
6468
6569
This creates the environment with Python and :term:`pip` in a directory
66-
called :samp:`myenv`.
70+
called :samp:`.venv`.
6771

6872
#. You can then activate this environment so that the next time you call
6973
``python``, it will use the Python from your new environment:
@@ -72,13 +76,13 @@ two-step process:
7276

7377
.. code-block:: console
7478
75-
$ . myenv/bin/activate
79+
$ . .venv/bin/activate
7680
7781
.. tab:: Windows
7882

7983
.. code-block:: ps1
8084
81-
> myenv\Scripts\activate.bat
85+
> .venv\Scripts\activate
8286
8387
#. Install Python packages only for this virtual environment, for example the
8488
popular ``pandas`` library:
@@ -87,13 +91,13 @@ two-step process:
8791

8892
.. code-block:: console
8993
90-
(myenv) $ python -m pip install pandas
94+
(.venv) $ python -m pip install pandas
9195
9296
.. tab:: Windows
9397

9498
.. code-block:: ps1
9599
96-
(myenv) > python.exe -m pip install pandas
100+
(.venv) > python.exe -m pip install pandas
97101
98102
#. If you want to finish your work on this project, you can deactivate the
99103
virtual environment again with
@@ -102,13 +106,13 @@ two-step process:
102106

103107
.. code-block:: console
104108
105-
(myenv) $ deactivate
109+
(.venv) $ deactivate
106110
107111
.. tab:: Windows
108112

109113
.. code-block:: ps1
110114
111-
(myenv) > deactivate
115+
(.venv) > deactivate
112116
113117
.. seealso::
114118
* :doc:`python3:tutorial/venv`

0 commit comments

Comments
 (0)