Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Sphinx to use Python 3.x interpreter

Tags:

I try to create documentation for a project written with Python 3.x. Sphinx is the tool I want to use and, according to the official site, its last version 1.1.2 is compatible with Python 3.1+. My OS is Archlinux, a Linux distribution which uses Python 3.2+ as the default Python package.

The installation and configuration is straight forward (easy_install -U Sphinx then sphinx-quickinstall) and I was never asked to choose between the 2.x or 3.x Python interpreter. But when I ask Sphinx to create the documentation of my project, my code is analyzed as if I wrote it for Python 2.x.

Is Sphinx ready for Python 3.x? Did I make a mistake?

like image 773
suizokukan Avatar asked Nov 04 '11 20:11

suizokukan


1 Answers

Installation: Install sphinx with pip for python3(pip3 like that).

    pip3 install -U sphinx 

Building: Makefile(linux/Mac) changes.

    SPHINXBUILD   = python -msphinx 

In above line in Makefile change python to python3(or python3.x) like

   SPHINXBUILD   = python3 -msphinx 

if default python is pointing to 2.x version python.

like image 89
pavan Avatar answered Sep 20 '22 15:09

pavan