Skip to content

Commit 18636b1

Browse files
committed
Docs: Update 'Installing Python modules'
1 parent 0adc728 commit 18636b1

File tree

1 file changed

+31
-59
lines changed

1 file changed

+31
-59
lines changed

Doc/installing/index.rst

Lines changed: 31 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
.. highlight:: none
1+
.. highlight:: shell
22

33
.. _installing-index:
44

55
*************************
6-
Installing Python Modules
6+
Installing Python modules
77
*************************
88

99
As a popular open source development project, Python has an active
1010
supporting community of contributors and users that also make their software
11-
available for other Python developers to use under open source license terms.
11+
available for other Python developers to use under open-source license terms.
1212

1313
This allows Python users to share and collaborate effectively, benefiting
1414
from the solutions others have already created to common (and sometimes
@@ -32,34 +32,24 @@ creating and sharing your own Python projects, refer to the
3232
Key terms
3333
=========
3434

35-
* ``pip`` is the preferred installer program. Starting with Python 3.4, it
35+
* :program:`pip` is the preferred installer program. It
3636
is included by default with the Python binary installers.
3737
* A *virtual environment* is a semi-isolated Python environment that allows
3838
packages to be installed for use by a particular application, rather than
3939
being installed system wide.
40-
* ``venv`` is the standard tool for creating virtual environments, and has
41-
been part of Python since Python 3.3. Starting with Python 3.4, it
42-
defaults to installing ``pip`` into all created virtual environments.
43-
* ``virtualenv`` is a third party alternative (and predecessor) to
44-
``venv``. It allows virtual environments to be used on versions of
45-
Python prior to 3.4, which either don't provide ``venv`` at all, or
46-
aren't able to automatically install ``pip`` into created environments.
47-
* The `Python Package Index <https://pypi.org>`__ is a public
40+
* ``venv`` is the standard tool for creating virtual environments.
41+
It defaults to installing :program:`pip` into all created virtual environments.
42+
* ``virtualenv`` is a third-party alternative (and predecessor) to
43+
``venv``.
44+
* The `Python Package Index (PyPI) <https://pypi.org>`__ is a public
4845
repository of open source licensed packages made available for use by
4946
other Python users.
50-
* the `Python Packaging Authority
47+
* The `Python Packaging Authority
5148
<https://www.pypa.io/>`__ is the group of
5249
developers and documentation authors responsible for the maintenance and
5350
evolution of the standard packaging tools and the associated metadata and
5451
file format standards. They maintain a variety of tools, documentation,
5552
and issue trackers on `GitHub <https://github.com/pypa>`__.
56-
* ``distutils`` is the original build and distribution system first added to
57-
the Python standard library in 1998. While direct use of ``distutils`` is
58-
being phased out, it still laid the foundation for the current packaging
59-
and distribution infrastructure, and it not only remains part of the
60-
standard library, but its name lives on in other ways (such as the name
61-
of the mailing list used to coordinate Python packaging standards
62-
development).
6353

6454
.. versionchanged:: 3.5
6555
The use of ``venv`` is now recommended for creating virtual environments.
@@ -77,7 +67,7 @@ The standard packaging tools are all designed to be used from the command
7767
line.
7868

7969
The following command will install the latest version of a module and its
80-
dependencies from the Python Package Index::
70+
dependencies from PyPI::
8171

8272
python -m pip install SomePackage
8373

@@ -104,7 +94,7 @@ explicitly::
10494

10595
python -m pip install --upgrade SomePackage
10696

107-
More information and resources regarding ``pip`` and its capabilities can be
97+
More information and resources regarding :program:`pip` and its capabilities can be
10898
found in the `Python Packaging User Guide <https://packaging.python.org>`__.
10999

110100
Creation of virtual environments is done through the :mod:`venv` module.
@@ -122,19 +112,6 @@ How do I ...?
122112

123113
These are quick answers or links for some common tasks.
124114

125-
... install ``pip`` in versions of Python prior to Python 3.4?
126-
--------------------------------------------------------------
127-
128-
Python only started bundling ``pip`` with Python 3.4. For earlier versions,
129-
``pip`` needs to be "bootstrapped" as described in the Python Packaging
130-
User Guide.
131-
132-
.. seealso::
133-
134-
`Python Packaging User Guide: Requirements for Installing Packages
135-
<https://packaging.python.org/installing/#requirements-for-installing-packages>`__
136-
137-
138115
.. installing-per-user-installation:
139116
140117
... install packages just for the current user?
@@ -148,10 +125,10 @@ package just for the current user, rather than for all users of the system.
148125
---------------------------------------
149126

150127
A number of scientific Python packages have complex binary dependencies, and
151-
aren't currently easy to install using ``pip`` directly. At this point in
152-
time, it will often be easier for users to install these packages by
128+
aren't currently easy to install using :program:`pip` directly.
129+
It will often be easier for users to install these packages by
153130
`other means <https://packaging.python.org/science/>`__
154-
rather than attempting to install them with ``pip``.
131+
rather than attempting to install them with :program:`pip`.
155132

156133
.. seealso::
157134

@@ -164,22 +141,18 @@ rather than attempting to install them with ``pip``.
164141

165142
On Linux, macOS, and other POSIX systems, use the versioned Python commands
166143
in combination with the ``-m`` switch to run the appropriate copy of
167-
``pip``::
144+
:program:`pip`::
168145

169-
python2 -m pip install SomePackage # default Python 2
170-
python2.7 -m pip install SomePackage # specifically Python 2.7
171-
python3 -m pip install SomePackage # default Python 3
172-
python3.4 -m pip install SomePackage # specifically Python 3.4
146+
python3 -m pip install SomePackage # default Python 3
147+
python3.14 -m pip install SomePackage # specifically Python 3.14
173148

174-
Appropriately versioned ``pip`` commands may also be available.
149+
Appropriately versioned :program:`pip` commands may also be available.
175150

176-
On Windows, use the ``py`` Python launcher in combination with the ``-m``
151+
On Windows, use the :program:`py` Python launcher in combination with the ``-m``
177152
switch::
178153

179-
py -2 -m pip install SomePackage # default Python 2
180-
py -2.7 -m pip install SomePackage # specifically Python 2.7
181-
py -3 -m pip install SomePackage # default Python 3
182-
py -3.4 -m pip install SomePackage # specifically Python 3.4
154+
py -3 -m pip install SomePackage # default Python 3
155+
py -3.14 -m pip install SomePackage # specifically Python 3.14
183156

184157
.. other questions:
185158
@@ -199,39 +172,38 @@ On Linux systems, a Python installation will typically be included as part
199172
of the distribution. Installing into this Python installation requires
200173
root access to the system, and may interfere with the operation of the
201174
system package manager and other components of the system if a component
202-
is unexpectedly upgraded using ``pip``.
175+
is unexpectedly upgraded using :program:`pip`.
203176

204177
On such systems, it is often better to use a virtual environment or a
205-
per-user installation when installing packages with ``pip``.
178+
per-user installation when installing packages with :program:`pip`.
206179

207180

208181
Pip not installed
209182
-----------------
210183

211-
It is possible that ``pip`` does not get installed by default. One potential fix is::
184+
It is possible that :program:`pip` does not get installed by default. One potential fix is::
212185

213186
python -m ensurepip --default-pip
214187

215-
There are also additional resources for `installing pip.
216-
<https://packaging.python.org/en/latest/tutorials/installing-packages/#ensure-pip-setuptools-and-wheel-are-up-to-date>`__
188+
There are also additional resources for `installing pip
189+
<https://packaging.python.org/en/latest/tutorials/installing-packages/#ensure-pip-setuptools-and-wheel-are-up-to-date>`__.
217190

218191

219192
Installing binary extensions
220193
----------------------------
221194

222-
Python has typically relied heavily on source based distribution, with end
195+
Python once relied heavily on source-based distribution, with end
223196
users being expected to compile extension modules from source as part of
224197
the installation process.
225198

226-
With the introduction of support for the binary ``wheel`` format, and the
227-
ability to publish wheels for at least Windows and macOS through the
228-
Python Package Index, this problem is expected to diminish over time,
199+
With the introduction of the binary wheel format, and the
200+
ability to publish wheels through PyPI, this problem is diminishing,
229201
as users are more regularly able to install pre-built extensions rather
230202
than needing to build them themselves.
231203

232204
Some of the solutions for installing `scientific software
233205
<https://packaging.python.org/science/>`__
234-
that are not yet available as pre-built ``wheel`` files may also help with
206+
that are not yet available as pre-built wheel files may also help with
235207
obtaining other binary extensions without needing to build them locally.
236208

237209
.. seealso::

0 commit comments

Comments
 (0)