Skip to content

Commit d6521f9

Browse files
authored
Merge pull request #928 from ichard26/tabify-pip-and-virtual-environments
Fix executable dir in + tabify pip & virtual envs guide
2 parents 4c3440d + 09fc053 commit d6521f9

1 file changed

Lines changed: 50 additions & 51 deletions

File tree

source/guides/installing-using-pip-and-virtual-environments.rst

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -19,46 +19,43 @@ update packages. You'll need to make sure you have the latest version of pip
1919
installed.
2020

2121

22-
Windows
23-
+++++++
24-
25-
The Python installers for Windows include pip. You should be able to access
26-
pip using:
22+
.. tab:: Unix/macOS
2723

28-
.. code-block:: bash
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+
:doc:`/guides/installing-using-linux-tools`.
2927

30-
py -m pip --version
31-
pip 9.0.1 from c:\python36\lib\site-packages (Python 3.6.1)
28+
You can also install pip yourself to ensure you have the latest version. It's
29+
recommended to use the system pip to bootstrap a user installation of pip:
3230

33-
You can make sure that pip is up-to-date by running:
31+
.. code-block:: bash
3432
35-
.. code-block:: bash
33+
python3 -m pip install --user --upgrade pip
3634
37-
py -m pip install --upgrade pip
35+
Afterwards, you should have the newest pip installed in your user site:
3836

37+
.. code-block:: bash
3938
40-
Linux and macOS
41-
++++++++++++++++
39+
python3 -m pip --version
40+
pip 9.0.1 from $HOME/.local/lib/python3.6/site-packages (python 3.6)
4241
43-
Debian and most other distributions include a `python-pip`_ package, if you
44-
want to use the Linux distribution-provided versions of pip see
45-
:doc:`/guides/installing-using-linux-tools`.
42+
.. _python-pip: https://packages.debian.org/stable/python-pip
4643

47-
You can also install pip yourself to ensure you have the latest version. It's
48-
recommended to use the system pip to bootstrap a user installation of pip:
44+
.. tab:: Windows
4945

50-
.. code-block:: bash
46+
The Python installers for Windows include pip. You should be able to access
47+
pip using:
5148

52-
python3 -m pip install --user --upgrade pip
49+
.. code-block:: bash
5350
54-
Afterwards, you should have the newest pip installed in your user site:
51+
py -m pip --version
52+
pip 9.0.1 from c:\python36\lib\site-packages (Python 3.6.1)
5553
56-
.. code-block:: bash
54+
You can make sure that pip is up-to-date by running:
5755

58-
python3 -m pip --version
59-
pip 9.0.1 from $HOME/.local/lib/python3.6/site-packages (python 3.6)
56+
.. code-block:: bash
6057
61-
.. _python-pip: https://packages.debian.org/stable/python-pip
58+
py -m pip install --upgrade pip
6259
6360
6461
Installing virtualenv
@@ -75,17 +72,18 @@ Using virtualenv allows you to avoid installing Python packages globally
7572
which could break system tools or other projects. You can install virtualenv
7673
using pip.
7774

78-
On macOS and Linux:
7975

80-
.. code-block:: bash
76+
.. tab:: Unix/macOS
8177

82-
python3 -m pip install --user virtualenv
78+
.. code-block:: bash
8379
84-
On Windows:
80+
python3 -m pip install --user virtualenv
8581
86-
.. code-block:: bash
82+
.. tab:: Windows
83+
84+
.. code-block:: bash
8785
88-
py -m pip install --user virtualenv
86+
py -m pip install --user virtualenv
8987
9088
9189
@@ -105,17 +103,17 @@ To create a virtual environment, go to your project's directory and run
105103
venv. If you are using Python 2, replace ``venv`` with ``virtualenv``
106104
in the below commands.
107105

108-
On macOS and Linux:
106+
.. tab:: Unix/macOS
109107

110-
.. code-block:: bash
108+
.. code-block:: bash
111109
112-
python3 -m venv env
110+
python3 -m venv env
113111
114-
On Windows:
112+
.. tab:: Windows
115113

116-
.. code-block:: bash
114+
.. code-block:: bash
117115
118-
py -m venv env
116+
py -m venv env
119117
120118
The second argument is the location to create the virtual environment. Generally, you
121119
can just create this in your project and call it ``env``.
@@ -134,33 +132,34 @@ need to *activate* it. Activating a virtual environment will put the
134132
virtual environment-specific
135133
``python`` and ``pip`` executables into your shell's ``PATH``.
136134

137-
On macOS and Linux:
135+
.. tab:: Unix/macOS
138136

139-
.. code-block:: bash
137+
.. code-block:: bash
140138
141-
source env/bin/activate
139+
source env/bin/activate
142140
143-
On Windows::
141+
.. tab:: Windows
142+
143+
.. code-block:: text
144144
145-
.\env\Scripts\activate
145+
.\env\Scripts\activate
146146
147147
You can confirm you're in the virtual environment by checking the location of your
148148
Python interpreter, it should point to the ``env`` directory.
149149

150-
On macOS and Linux:
151-
152-
.. code-block:: bash
150+
.. tab:: Unix/macOS
153151

154-
which python
155-
.../env/bin/python
152+
.. code-block:: bash
156153
157-
On Windows:
154+
which python
155+
.../env/bin/python
158156
159-
.. code-block:: bash
157+
.. tab:: Windows
160158

161-
where python
162-
.../env/bin/python.exe
159+
.. code-block:: text
163160
161+
where python
162+
...\env\Scripts\python.exe
164163
165164
As long as your virtual environment is activated pip will install packages into that
166165
specific environment and you'll be able to import and use packages in your

0 commit comments

Comments
 (0)