@@ -23,7 +23,7 @@ The guide covers how to:
23
23
24
24
.. important ::
25
25
This guide has the prerequisite that you are using an official Python version obtained from
26
- <https://www.python.org/downloads/> is installed . If you are using your operating
26
+ <https://www.python.org/downloads/>. If you are using your operating
27
27
system's package manager to install Python, please ensure that Python is
28
28
installed before proceeding with these steps.
29
29
@@ -46,7 +46,7 @@ another project's environment.
46
46
party packages.
47
47
48
48
To create a virtual environment, go to your project's directory and run
49
- ``venv ``.
49
+ ``venv ``. This will create a new virtual environment in a local folder `` .venv ``:
50
50
51
51
.. tab :: Unix/macOS
52
52
@@ -87,7 +87,7 @@ shell's ``PATH``.
87
87
88
88
.. code-block :: bat
89
89
90
- .\. venv\Scripts\activate
90
+ .venv\bin\Activate.bat
91
91
92
92
To confirm the virtual environment is activated, check the location of your
93
93
Python interpreter:
@@ -117,7 +117,7 @@ the ``.venv`` directory:
117
117
118
118
.. code-block :: bat
119
119
120
- ...\.venv\Scripts \python.exe
120
+ ...\.venv\bin \python.exe
121
121
122
122
123
123
While a virtual environment is activated, pip will install packages into that
@@ -135,6 +135,10 @@ If you want to switch projects or leave your virtual environment,
135
135
136
136
deactivate
137
137
138
+ .. note ::
139
+ Closing your shell will deactivate the virtual environment. If
140
+ you open a new shell window and want to use the virtual environment,
141
+ reactivate it.
138
142
139
143
Reactivate a virtual environment
140
144
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -153,26 +157,19 @@ It's used to install and update packages into a virtual environment.
153
157
154
158
.. tab :: Unix
155
159
156
- Debian and most other distributions include a `python-pip `_ package; if you
157
- want to use the Linux distribution-provided versions of pip, see
158
- :doc: `/guides/installing-using-linux-tools `.
159
-
160
- You can also install pip yourself to ensure you have the latest version. It's
161
- recommended to use the system pip to bootstrap a user installation of pip:
160
+ You can make sure that pip is up-to-date by running:
162
161
163
162
.. code-block :: bash
164
163
165
- python3 -m pip install --user -- upgrade pip
164
+ python3 -m pip install --upgrade pip
166
165
python3 -m pip --version
167
166
168
167
Afterwards, you should have the latest version of pip installed in your
169
168
user site:
170
169
171
170
.. code-block :: text
172
171
173
- pip 21.1.3 from $HOME/.local/lib/python3.9/site-packages (python 3.9)
174
-
175
- .. _python-pip : https://packages.debian.org/stable/python/python3-pip
172
+ pip 21.1.3 from ../.venv/lib/python3.9/site-packages (python 3.9)
176
173
177
174
.. tab :: macOS
178
175
@@ -189,9 +186,7 @@ It's used to install and update packages into a virtual environment.
189
186
190
187
.. code-block :: text
191
188
192
- pip 21.1.3 from $HOME/.local/lib/python3.9/site-packages (python 3.9)
193
-
194
- .. _python-pip : https://packages.debian.org/stable/python/python3-pip
189
+ pip 23.3.1 from $HOME/.venv/lib/python3.9/site-packages (python 3.9)
195
190
196
191
.. tab :: Windows
197
192
@@ -207,7 +202,7 @@ It's used to install and update packages into a virtual environment.
207
202
208
203
.. code-block :: text
209
204
210
- pip 21.1.3 from c:\python39 \lib\site-packages (Python 3.9.4)
205
+ pip 23.3.1 from .venv \lib\site-packages (Python 3.9.4)
211
206
212
207
213
208
Install packages using pip
0 commit comments