Sphinx 0.6.3: 找不到语言模块

1 投票
1 回答
946 浏览
提问于 2025-04-15 17:31

当我尝试使用sphinx-quickstart生成的make.bat命令时,出现了以下错误信息:

make 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时出现了问题(我搜索了一下错误信息的一部分,发现只有init.py这个文件出现了),因为错误是在导入cmdline的try块中出现的。

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

我没有看到“languages”是如何作为参数传递的,所以我对这个错误信息感到困惑。我搜索了解决方案,但没有找到任何结果。

1 个回答

0

在sphinx这个包里搜索“languages”,找到的唯一相关的导入是:

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

所以很可能是你的docutils安装出了问题。老实说,如果错误信息能显示完整的包路径,那就更有帮助了。

撰写回答