Installing Python, Sphinx and NumPy on Windows

Python

Python comes in two flavors: the 2.x branch (stopped at 2.7.x) and the 3.x branch, under active development but which breaks the retro-compatibility with the 2.x branch. You can choose either one to use with OpenCV. If you plan to learn Python, then go for the 3.x branch. However, if you deal with old code or old packages, then the 2.x version is preferable for compatibility reasons. I recommend using Python 3.x, which is now mature. Here is more about the difference between Python 2 and Python 3: https://wiki.python.org/moin/Python2orPython3.

Download Python and install it with the default options.

Python should now be installed in C:\Python34 by default (the folder name may vary depending on the Python version).

Sphinx

Sphinx can be viewed as a Python extension. It is actually a set of Python scripts to create documentation. The installation is made really easy by a nice tool called pip, which is contained in the Python official installation. This tool can download and install 3rd-party libraries with a single command. It will automatically connect to the Python databases and download the latest version of many Python scripts.

Beforehand, you have to make sure your Path environement variable contains the following paths: C:\Python34 and C:\Python34\Scripts (the two digits of the PythonXX folder may vary depending on your Python version). Check your User Path and add these paths if needed following the instructions provided here.

Now open a Powershell command prompt and issue the following commands to install Sphinx:

pip install sphinx

This will also install its prerequisites Jinja2 and Pygments, among others.

Sphinx and all of its dependencies should now be installed in C:\Python34\Scripts by default. You can check that the installation is working by issuing the following command:

sphinx-build --help

If everything worked fine, you will get a Sphinx version number and a list of options for this command.

Note

The messages printed out in the console when using Sphinx might contain some weird characters in Powershell. This happens both with Python 2.x and 3.x. However, this does not happen with the old command prompt cmd.exe. This will hopefully be corrected in a later version of Sphinx.

Note

Sphinx official installation instructions (more detailed) are available here: http://sphinx-doc.org/install.html.

NumPy

The easiest way to install NumPy is to just download the installer of this package from the SourceForge page. Make sure you pick the installer corresponding to your Python version (2.x or 3.x).

Launch the installer and install NumPy with the default options.