Python 生成文档时sphinx生成错误

Python 生成文档时sphinx生成错误,python,python-sphinx,Python,Python Sphinx,我试图使用sphinx构建API文档,但在构建时出现了此错误 使用命令sphinxbuild-bhtml-d\u build/doctrees_build/html Erorr日志: $ make docs rm -f docs/markovipy.rst rm -f docs/modules.rst sphinx-apidoc -o docs/ markovipy Creating file docs/markovipy.rst. Creating file docs/modules.rst.

我试图使用sphinx构建API文档,但在构建时出现了此错误

使用命令
sphinxbuild-bhtml-d\u build/doctrees_build/html

Erorr日志:

$ make docs
rm -f docs/markovipy.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ markovipy
Creating file docs/markovipy.rst.
Creating file docs/modules.rst.
/Library/Developer/CommandLineTools/usr/bin/make -C docs clean
rm -rf _build/*
/Library/Developer/CommandLineTools/usr/bin/make -C docs html
sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.4.8
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 9 source files that are out of date
updating environment: 9 added, 0 changed, 0 removed
reading sources... [100%] usage
/Users/user/development/projects/markovipy/docs/index.rst:6: WARNING: toctree contains reference to nonexisting document 'authorshistory'
/Users/user/development/projects/markovipy/markovipy/utils.py:docstring of markovipy.utils.get_word_list:7: ERROR: Unknown target name: "a-za-z0-9".
../README.rst:None: WARNING: nonlocal image URI found: https://img.shields.io/pypi/v/markovipy.svg
../README.rst:None: WARNING: nonlocal image URI found: https://img.shields.io/travis/prodicus/markovipy.svg
../README.rst:None: WARNING: nonlocal image URI found: https://readthedocs.org/projects/markovipy/badge/?version=latest
../README.rst:None: WARNING: nonlocal image URI found: https://pyup.io/repos/github/prodicus/markovipy/shield.svg
looking for now-outdated files... none found
pickling environment... done
checking consistency... /Users/user/development/projects/markovipy/docs/authors.rst:: WARNING: document isn't included in any toctree
/Users/user/development/projects/markovipy/docs/history.rst:: WARNING: document isn't included in any toctree
/Users/user/development/projects/markovipy/docs/modules.rst:: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [ 88%] readme
Exception occurred:
  File "/Users/user/.virtualenvs/py3/lib/python3.6/site-packages/docutils/writers/_html_base.py", line 671, in depart_document
    assert not self.context, 'len(context) = %s' % len(self.context)
AssertionError: len(context) = 3
The full traceback has been saved in /var/folders/sw/nsjcqtxs1yldt7y1gsqkfnw00000gn/T/sphinx-err-sz5bisnz.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
make[1]: *** [html] Error 1
make: *** [docs] Error 2
我用于sphinx的
conf.py
文件

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import os

cwd = os.getcwd()
project_root = os.path.dirname(cwd)

sys.path.insert(0, project_root)

import markovipy

extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix of source filenames.
source_suffix = '.rst'

master_doc = 'index'

# General information about the project.
project = u'markovipy'
copyright = u"2017, Tasdik Rahman"

version = markovipy.__version__
# The full version, including alpha/beta/rc tags.
release = markovipy.__version__

exclude_patterns = ['_build']

pygments_style = 'sphinx'

html_theme = 'default'

html_static_path = ['_static']

htmlhelp_basename = 'markovipydoc'


# -- Options for LaTeX output ------------------------------------------

latex_elements = {
    # The paper size ('letterpaper' or 'a4paper').
    #'papersize': 'letterpaper',

    # The font size ('10pt', '11pt' or '12pt').
    #'pointsize': '10pt',

    # Additional stuff for the LaTeX preamble.
    #'preamble': '',
}

latex_documents = [
    ('index', 'markovipy.tex',
     u'markovipy Documentation',
     u'Tasdik Rahman', 'manual'),
]

man_pages = [
    ('index', 'markovipy',
     u'markovipy Documentation',
     [u'Tasdik Rahman'], 1)
]

texinfo_documents = [
    ('index', 'markovipy',
     u'markovipy Documentation',
     u'Tasdik Rahman',
     'markovipy',
     'One line description of project.',
     'Miscellaneous'),
]

当我使用
Sphinx==1.4.8

当我升级到
Sphinx==1.5.5

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import os

cwd = os.getcwd()
project_root = os.path.dirname(cwd)

sys.path.insert(0, project_root)

import markovipy

extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix of source filenames.
source_suffix = '.rst'

master_doc = 'index'

# General information about the project.
project = u'markovipy'
copyright = u"2017, Tasdik Rahman"

version = markovipy.__version__
# The full version, including alpha/beta/rc tags.
release = markovipy.__version__

exclude_patterns = ['_build']

pygments_style = 'sphinx'

html_theme = 'default'

html_static_path = ['_static']

htmlhelp_basename = 'markovipydoc'


# -- Options for LaTeX output ------------------------------------------

latex_elements = {
    # The paper size ('letterpaper' or 'a4paper').
    #'papersize': 'letterpaper',

    # The font size ('10pt', '11pt' or '12pt').
    #'pointsize': '10pt',

    # Additional stuff for the LaTeX preamble.
    #'preamble': '',
}

latex_documents = [
    ('index', 'markovipy.tex',
     u'markovipy Documentation',
     u'Tasdik Rahman', 'manual'),
]

man_pages = [
    ('index', 'markovipy',
     u'markovipy Documentation',
     [u'Tasdik Rahman'], 1)
]

texinfo_documents = [
    ('index', 'markovipy',
     u'markovipy Documentation',
     u'Tasdik Rahman',
     'markovipy',
     'One line description of project.',
     'Miscellaneous'),
]