1

当我尝试使用 sphinx-quickstart 生成的 make.bat 命令时收到以下错误消息:

制作html

错误:找不到语言模块。您是否正确安装了 Sphinx 及其依赖项?

我尝试运行 sphinx-build 命令并收到相同的错误。

我在 Windows Vista 上使用 Python 2.6.4。我已经安装了 setuptools-0.6c11.win32-py2.6,并使用 easy_install 安装了 Sphinx 0.6.3。

似乎init .py 在尝试导入 cmdline 时失败(我 grep 了错误消息的一部分,而init .py 是唯一出现的文件),因为错误出现在try导入 cmdline 的块中。

try:
    from sphinx import cmdline
except ImportError, err:
    errstr = str(err)
    if errstr.lower().startswith('no module named'):
        whichmod = errstr[16:]
        hint = ''
        if whichmod.startswith('docutils'):
            whichmod = 'Docutils library'
        elif whichmod.startswith('jinja'):
            whichmod = 'Jinja library'
        elif whichmod == 'roman':
            whichmod = 'roman module (which is distributed with Docutils)'
            hint = ('This can happen if you upgraded docutils using\n'
                    'easy_install without uninstalling the old version'
                    'first.')
        else:
            whichmod += ' module'
        print >>sys.stderr, ('Error: The %s cannot be found. '
                             'Did you install Sphinx and its dependencies '
                             'correctly?' % whichmod)
        if hint:
            print >> sys.stderr, hint
        return 1
    raise

我看不到“语言”会作为参数传递到哪里,所以我对错误消息感到困惑。我一直在寻找解决方案,但一无所获。

4

1 回答 1

0

通过 sphinx 包查找“语言”,唯一相关的导入是:

/usr/lib/pymodules/python2.5/sphinx/environment.py:from docutils.parsers.rst.languages import en as english

因此,您的 docutils 安装很可能有问题。诚然,如果报告完整的包路径,错误消息会更有帮助。

于 2010-01-01T14:08:19.953 回答