2018-02-06 14:22:10 -06:00
|
|
|
=================
|
2013-01-18 16:17:11 -06:00
|
|
|
Installing Sphinx
|
2013-03-29 05:45:07 -05:00
|
|
|
=================
|
2013-01-18 16:17:11 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
.. contents::
|
|
|
|
:depth: 1
|
|
|
|
:local:
|
|
|
|
:backlinks: none
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
Overview
|
|
|
|
--------
|
2013-01-18 16:17:11 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
Sphinx is written in `Python`__ and supports both Python 2.7 and Python 3.3+.
|
|
|
|
We recommend the latter.
|
2013-01-18 16:17:11 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
__ http://docs.python-guide.org/en/latest/
|
2013-01-18 16:17:11 -06:00
|
|
|
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
Linux
|
|
|
|
-----
|
|
|
|
|
|
|
|
Debian/Ubuntu
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Install either ``python3-sphinx`` (Python 3) or ``python-sphinx`` (Python 2)
|
|
|
|
using :command:`apt-get`:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ apt-get install python3-sphinx
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
If it not already present, this will install Python for you.
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
RHEL, CentOS
|
|
|
|
~~~~~~~~~~~~
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
Install ``python-sphinx`` using :command:`yum`:
|
2013-01-20 01:06:04 -06:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
$ yum install python-sphinx
|
|
|
|
|
|
|
|
If it not already present, this will install Python for you.
|
|
|
|
|
|
|
|
Other distributions
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
2013-03-29 05:45:07 -05:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
Most Linux distributions have Sphinx in their package repositories. Usually
|
|
|
|
the package is called ``python3-sphinx``, ``python-sphinx`` or ``sphinx``. Be
|
|
|
|
aware that there are at least two other packages with ``sphinx`` in their name:
|
|
|
|
a speech recognition toolkit (*CMU Sphinx*) and a full-text search database
|
|
|
|
(*Sphinx search*).
|
2013-03-29 05:45:07 -05:00
|
|
|
|
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
macOS
|
|
|
|
-----
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-03-17 16:56:53 -05:00
|
|
|
Sphinx can be installed using `Homebrew`__, `MacPorts`__, or as part of
|
|
|
|
a Python distribution such as `Anaconda`__.
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
__ https://brew.sh/
|
|
|
|
__ https://www.macports.org/
|
2018-03-17 16:56:53 -05:00
|
|
|
__ https://www.anaconda.com/download/#macos
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
Homebrew
|
|
|
|
~~~~~~~~
|
2013-01-20 01:06:04 -06:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
$ brew install sphinx-doc
|
|
|
|
|
|
|
|
For more information, refer to the `package overview`__.
|
|
|
|
|
|
|
|
__ http://formulae.brew.sh/formula/sphinx-doc
|
|
|
|
|
|
|
|
MacPorts
|
|
|
|
~~~~~~~~
|
|
|
|
|
|
|
|
Install either ``python36-sphinx`` (Python 3) or ``python27-sphinx`` (Python 2)
|
|
|
|
using :command:`port`:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ sudo port install py36-sphinx
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2013-03-29 05:45:07 -05:00
|
|
|
To set up the executable paths, use the ``port select`` command:
|
2013-01-20 01:06:04 -06:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
$ sudo port select --set python python36
|
|
|
|
$ sudo port select --set sphinx py36-sphinx
|
|
|
|
|
|
|
|
For more information, refer to the `package overview`__.
|
|
|
|
|
|
|
|
__ https://www.macports.org/ports.php?by=library&substr=py36-sphinx
|
|
|
|
|
2018-03-17 16:56:53 -05:00
|
|
|
Anaconda
|
|
|
|
~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ conda install sphinx
|
2018-02-06 14:22:10 -06:00
|
|
|
|
|
|
|
Windows
|
|
|
|
-------
|
|
|
|
|
|
|
|
.. todo:: Could we start packaging this?
|
|
|
|
|
|
|
|
Most Windows users do not have Python installed by default, so we begin with
|
|
|
|
the installation of Python itself. If you are unsure, open the *Command
|
2018-03-28 20:04:05 -05:00
|
|
|
Prompt* (:kbd:`⊞Win-r` and type :command:`cmd`). Once the command prompt is
|
2018-02-06 14:22:10 -06:00
|
|
|
open, type :command:`python --version` and press Enter. If Python is
|
|
|
|
available, you will see the version of Python printed to the screen. If you do
|
|
|
|
not have Python installed, refer to the `Hitchhikers Guide to Python's`__
|
|
|
|
Python on Windows installation guides. You can install either `Python 3`__ or
|
|
|
|
`Python 2.7`__. Python 3 is recommended.
|
|
|
|
|
|
|
|
Once Python is installed, you can install Sphinx using :command:`pip`. Refer
|
|
|
|
to the :ref:`pip installation instructions <install-pypi>` below for more
|
|
|
|
information.
|
|
|
|
|
|
|
|
__ http://docs.python-guide.org/en/latest/
|
|
|
|
__ http://docs.python-guide.org/en/latest/starting/install3/win/
|
|
|
|
__ http://docs.python-guide.org/en/latest/starting/install/win/
|
|
|
|
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
.. _install-pypi:
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
Installation from PyPI
|
|
|
|
----------------------
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
Sphinx packages are published on the `Python Package Index
|
|
|
|
<https://pypi.python.org/pypi/Sphinx>`_. The preferred tool for installing
|
|
|
|
packages from *PyPI* is :command:`pip`. This tool is provided with all modern
|
|
|
|
versions of Python.
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
On Linux or MacOS, you should open your terminal and run the following command.
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
.. code-block:: shell
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
$ pip install -U sphinx
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-03-28 20:04:05 -05:00
|
|
|
On Windows, you should open *Command Prompt* (:kbd:`⊞Win-r` and type
|
2018-02-06 14:22:10 -06:00
|
|
|
:command:`cmd`) and run the same command.
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
.. code-block:: bat
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
C:\> pip install -U sphinx
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
After installation, type :command:`sphinx-build --version` on the command
|
|
|
|
prompt. If everything worked fine, you will see the version number for the
|
|
|
|
Sphinx package you just installed.
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
Installation from *PyPI* also allows you to install the latest development
|
|
|
|
release. You will not generally need (or want) to do this, but it can be
|
|
|
|
useful if you see a possible bug in the latest stable release. To do this, use
|
|
|
|
the ``--pre`` flag.
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
.. code-block:: shell
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
$ pip install -U --pre sphinx
|
2014-12-03 08:17:48 -06:00
|
|
|
|
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
Installation from source
|
|
|
|
------------------------
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
You can install Sphinx directly from a clone of the `Git repository`__. This
|
|
|
|
can be done either by cloning the repo and installing from the local clone, on
|
|
|
|
simply installing directly via :command:`git`.
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
.. code-block:: shell
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
$ git clone https://github.com/sphinx-doc/sphinx
|
|
|
|
$ cd sphinx
|
|
|
|
$ pip install .
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
.. code-block:: shell
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
$ pip install git+https://github.com/sphinx-doc/sphinx
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
You can also download a snapshot of the Git repo in either `tar.gz`__ or
|
|
|
|
`zip`__ format. Once downloaded and extracted, these can be installed with
|
|
|
|
:command:`pip` as above.
|
2013-01-20 01:06:04 -06:00
|
|
|
|
2018-02-06 14:22:10 -06:00
|
|
|
__ https://github.com/sphinx-doc/sphinx
|
|
|
|
__ https://github.com/sphinx-doc/sphinx/archive/master.tar.gz
|
|
|
|
__ https://github.com/sphinx-doc/sphinx/archive/master.zip
|