Skip to content

Commit d86bd42

Browse files
committed
Move docs to a topic
1 parent a36e4a9 commit d86bd42

File tree

3 files changed

+39
-43
lines changed

3 files changed

+39
-43
lines changed

docs/html/topics/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ local-project-installs
1818
repeatable-installs
1919
secure-installs
2020
vcs-support
21+
python-option
2122
```

docs/html/topics/python-option.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Managing a different Python interpreter
2+
3+
4+
Occasionally, you may want to use pip to manage a Python installation other than
5+
the one pip is installed into. In this case, you can use the `--python` option
6+
to specify the interpreter you want to manage. This option can take one of three
7+
values:
8+
9+
1. The path to a Python executable.
10+
2. The path to a virtual environment.
11+
3. Either "py" or "python", referring to the currently active Python interpreter.
12+
13+
In all 3 cases, pip will run exactly as if it had been invoked from that Python
14+
environment.
15+
16+
One example of where this might be useful is to manage a virtual environment
17+
that does not have pip installed.
18+
19+
````{tab} Unix/macOS
20+
```{code-block} console
21+
$ python -m venv .venv --without-pip
22+
$ python -m pip --python .venv install SomePackage
23+
[...]
24+
Successfully installed SomePackage
25+
```
26+
````
27+
````{tab} Windows
28+
```{code-block} console
29+
C:\> py -m venv .venv --without-pip
30+
C:\> py -m pip --python .venv install SomePackage
31+
[...]
32+
Successfully installed SomePackage
33+
```
34+
````
35+
36+
You could also use `--python .venv/bin/python` (or on Windows,
37+
`--python .venv\Scripts\python.exe`) if you wanted to be explicit, but the
38+
virtual environment name is shorter and works exactly the same.

docs/html/user_guide.rst

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -782,49 +782,6 @@ This is now covered in :doc:`../topics/repeatable-installs`.
782782

783783
This is now covered in :doc:`../topics/dependency-resolution`.
784784

785-
.. _`Managing a different Python interpreter`:
786-
787-
Managing a different Python interpreter
788-
=======================================
789-
790-
Occasionally, you may want to use pip to manage a Python installation other than
791-
the one pip is installed into. In this case, you can use the ``--python`` option
792-
to specify the interpreter you want to manage. This option can take one of three
793-
values:
794-
795-
#. The path to a Python executable.
796-
#. The path to a virtual environment.
797-
#. Either "py" or "python", referring to the currently active Python interpreter.
798-
799-
In all 3 cases, pip will run exactly as if it had been invoked from that Python
800-
environment.
801-
802-
One example of where this might be useful is to manage a virtual environment
803-
that does not have pip installed.
804-
805-
.. tab:: Unix/macOS
806-
807-
.. code-block:: console
808-
809-
$ python -m venv .venv --without-pip
810-
$ python -m pip --python .venv install SomePackage
811-
[...]
812-
Successfully installed SomePackage
813-
814-
.. tab:: Windows
815-
816-
.. code-block:: console
817-
818-
C:\> py -m venv .venv --without-pip
819-
C:\> py -m pip --python .venv install SomePackage
820-
[...]
821-
Successfully installed SomePackage
822-
823-
You could also use ``--python .venv/bin/python`` (or on Windows,
824-
``--python .venv\Scripts\python.exe``) if you wanted to be explicit, but the
825-
virtual environment name is shorter and works exactly the same.
826-
827-
828785
.. _`Using pip from your program`:
829786

830787
Using pip from your program

0 commit comments

Comments
 (0)