@@ -21,8 +21,8 @@ installed.
21
21
22
22
.. tab :: Unix/macOS
23
23
24
- Debian and most other distributions include a `python-pip `_ package, if you
25
- want to use the Linux distribution-provided versions of pip see
24
+ Debian and most other distributions include a `python-pip `_ package; if you
25
+ want to use the Linux distribution-provided versions of pip, see
26
26
:doc: `/guides/installing-using-linux-tools `.
27
27
28
28
You can also install pip yourself to ensure you have the latest version. It's
@@ -32,30 +32,34 @@ installed.
32
32
33
33
python3 -m pip install --user --upgrade pip
34
34
35
- Afterwards, you should have the newest pip installed in your user site:
35
+ python3 -m pip --version
36
36
37
- .. code-block :: bash
37
+ Afterwards, you should have the latest version of pip installed in your
38
+ user site:
38
39
39
- python3 -m pip --version
40
- pip 9.0.1 from $HOME /.local/lib/python3.6/site-packages (python 3.6)
40
+ .. code-block :: text
41
+
42
+ pip 21.1.3 from $HOME/.local/lib/python3.9/site-packages (python 3.9)
41
43
42
44
.. _python-pip : https://packages.debian.org/stable/python-pip
43
45
44
46
.. tab :: Windows
45
47
46
- The Python installers for Windows include pip. You should be able to access
47
- pip using :
48
+ The Python installers for Windows include pip. You can make sure that pip is
49
+ up-to-date by running :
48
50
49
- .. code-block :: bash
51
+ .. code-block :: bat
52
+
53
+ py -m pip install --upgrade pip
50
54
51
55
py -m pip --version
52
- pip 9.0.1 from c:\p ython36\l ib\s ite-packages (Python 3.6.1)
53
56
54
- You can make sure that pip is up-to-date by running :
57
+ Afterwards, you should have the latest version of pip :
55
58
56
- .. code-block :: bash
59
+ .. code-block :: text
60
+
61
+ pip 21.1.3 from c:\python39\lib\site-packages (Python 3.9.4)
57
62
58
- py -m pip install --upgrade pip
59
63
60
64
61
65
Installing virtualenv
@@ -81,7 +85,7 @@ using pip.
81
85
82
86
.. tab :: Windows
83
87
84
- .. code-block :: bash
88
+ .. code-block :: bat
85
89
86
90
py -m pip install --user virtualenv
87
91
@@ -111,7 +115,7 @@ in the below commands.
111
115
112
116
.. tab :: Windows
113
117
114
- .. code-block :: bash
118
+ .. code-block :: bat
115
119
116
120
py -m venv env
117
121
@@ -140,27 +144,40 @@ virtual environment-specific
140
144
141
145
.. tab :: Windows
142
146
143
- .. code-block :: text
147
+ .. code-block :: bat
144
148
145
149
.\env\Scripts\activate
146
150
147
151
You can confirm you're in the virtual environment by checking the location of your
148
- Python interpreter, it should point to the `` env `` directory.
152
+ Python interpreter:
149
153
150
154
.. tab :: Unix/macOS
151
155
152
156
.. code-block :: bash
153
157
154
158
which python
155
- .../env/bin/python
156
159
157
160
.. tab :: Windows
158
161
159
- .. code-block :: text
162
+ .. code-block :: bat
160
163
161
164
where python
165
+
166
+ It should be in the ``env `` directory:
167
+
168
+ .. tab :: Unix/macOS
169
+
170
+ .. code-block :: bash
171
+
172
+ .../env/bin/python
173
+
174
+ .. tab :: Windows
175
+
176
+ .. code-block :: bat
177
+
162
178
...\env\Scripts\python.exe
163
179
180
+
164
181
As long as your virtual environment is activated pip will install packages into that
165
182
specific environment and you'll be able to import and use packages in your
166
183
Python application.
@@ -193,7 +210,7 @@ Now that you're in your virtual environment you can install packages. Let's inst
193
210
194
211
.. tab :: Windows
195
212
196
- .. code-block :: bash
213
+ .. code-block :: bat
197
214
198
215
py -m pip install requests
199
216
@@ -232,7 +249,7 @@ a specific version of ``requests``:
232
249
233
250
.. tab :: Windows
234
251
235
- .. code-block :: bash
252
+ .. code-block :: bat
236
253
237
254
py -m pip install requests== 2.18.4
238
255
@@ -246,7 +263,7 @@ To install the latest ``2.x`` release of requests:
246
263
247
264
.. tab :: Windows
248
265
249
- .. code-block :: bash
266
+ .. code-block :: bat
250
267
251
268
py -m pip install requests> =2.0.0,< 3.0.0
252
269
@@ -260,7 +277,7 @@ To install pre-release versions of packages, use the ``--pre`` flag:
260
277
261
278
.. tab :: Windows
262
279
263
- .. code-block :: bash
280
+ .. code-block :: bat
264
281
265
282
py -m pip install --pre requests
266
283
@@ -279,7 +296,7 @@ specifying the extra in brackets:
279
296
280
297
.. tab :: Windows
281
298
282
- .. code-block :: bash
299
+ .. code-block :: bat
283
300
284
301
py -m pip install requests[security]
285
302
@@ -301,7 +318,7 @@ pip can install a package directly from source, for example:
301
318
302
319
.. tab :: Windows
303
320
304
- .. code-block :: bash
321
+ .. code-block :: bat
305
322
306
323
cd google-auth
307
324
py -m pip install .
@@ -318,7 +335,7 @@ installed package without needing to re-install:
318
335
319
336
.. tab :: Windows
320
337
321
- .. code-block :: bash
338
+ .. code-block :: bat
322
339
323
340
py -m pip install --editable .
324
341
@@ -354,7 +371,7 @@ wheel, or tar file) you can install it directly with pip:
354
371
355
372
.. tab :: Windows
356
373
357
- .. code-block :: bash
374
+ .. code-block :: bat
358
375
359
376
py -m pip install requests-2.18.4.tar.gz
360
377
@@ -370,7 +387,7 @@ pip to look for packages there and not to use the
370
387
371
388
.. tab :: Windows
372
389
373
- .. code-block :: bash
390
+ .. code-block :: bat
374
391
375
392
py -m pip install --no-index --find-links=/local/dir/ requests
376
393
@@ -393,7 +410,7 @@ If you want to download packages from a different index than the
393
410
394
411
.. tab :: Windows
395
412
396
- .. code-block :: bash
413
+ .. code-block :: bat
397
414
398
415
py -m pip install --index-url http://index.example.com/simple/ SomeProject
399
416
@@ -409,7 +426,7 @@ and a separate index, you can use the ``--extra-index-url`` flag instead:
409
426
410
427
.. tab :: Windows
411
428
412
- .. code-block :: bash
429
+ .. code-block :: bat
413
430
414
431
py -m pip install --extra-index-url http://index.example.com/simple/ SomeProject
415
432
@@ -427,7 +444,7 @@ install the latest version of ``requests`` and all of its dependencies:
427
444
428
445
.. tab :: Windows
429
446
430
- .. code-block :: bash
447
+ .. code-block :: bat
431
448
432
449
py -m pip install --upgrade requests
433
450
@@ -453,7 +470,7 @@ And tell pip to install all of the packages in this file using the ``-r`` flag:
453
470
454
471
.. tab :: Windows
455
472
456
- .. code-block :: bash
473
+ .. code-block :: bat
457
474
458
475
py -m pip install -r requirements.txt
459
476
@@ -471,7 +488,7 @@ Pip can export a list of all installed packages and their versions using the
471
488
472
489
.. tab :: Windows
473
490
474
- .. code-block :: bash
491
+ .. code-block :: bat
475
492
476
493
py -m pip freeze
477
494
0 commit comments