11

We use Sphinx for documentation within our Linux/OSX python environment, but we have someone on Windows who would like to be able to get an environment in which they can edit and build the Sphinx documentation.

Is it possible to set up Sphinx on windows? I'm guessing the hard part is installing a python environment and all the dependencies, but I have 0 experience with python on windows so somebody might be able to point me to a straightforward way to proceed.

mzjn
  • 48,958
  • 13
  • 128
  • 248
kdt
  • 27,905
  • 33
  • 92
  • 139

3 Answers3

2

For installing python on windows download Python. Run the executable and you are all set.

If you have pip installed then you can open command prompt and just type

pip install -U Sphinx

If you don't have pip installed then you first need to install it by using the following at the command prompt

python -m pip install -U pip
Krishna
  • 5,194
  • 2
  • 28
  • 33
  • Small update for this: Newer versions they all install pip automatically so you don't need to worry about it. – Saelyth Oct 30 '17 at 07:10
0

You can use pip-win now to set up sphinx in a virtualenv on windows easily.

First, download and install Python. If you want to use the latexpdf builder you will also need to install either TeX Live or MiKTeX for windows.

Next, run the pip-win.exe. It will automatically pull the required setuptools required and install pip and virtualenv on your system. When loaded it will pull up the Python you just installed, but if you installed it in a location other than default directory you can easily enter the absolute path or browse for it.

Next, in the Command: line you can create a new virtualenv by inputing:

venv -c C:\foo\sphinx-venv

This will open a command prompt with you inside your virtualenv. Following this you can install sphinx with the pip command:

<sphinx-venv> C:\foo\> pip install sphinx

Now sphinx is installed on your windows machine in a virtual enviroment. You can use deactivate to escape your new environment.

When ever you wish to enter your virtualenv again to build more sphinx projects you can either open pip-win and run:

venv C:\foo\sphinx-venv

Or you can create a custom python file to activate your sphinx environment and build your sphinx file such as:

import os
os.system("cmd /c \"CALL C:\\foo\\sphinx-venv\\Scripts\\activate.bat && make html\"")
Cole
  • 1,699
  • 1
  • 17
  • 21
0

By far the simplest way to use Python on Windows is WinPython, which is a portable distribution that is as simple to use as any other portable app. It'll give you an icon for a WinPython command prompt from which you can use pip, etc., as if on any other (e.g. linux) system, or you can download packages and install them using WinPython's control panel.

RichardB
  • 114
  • 9