pip install Sphinx
or you can also install using easy_install
easy_install -U sphinx
Then you can check that it has been correctly installed by executing the following command:
> sphinx-quickstart --version Sphinx v1.4.1
Before proceeding ahead you need to follow certain code style for python PEP 8. If you have followed PEP 8 guideline then you can define document structure in sphinx and start building your documentation.