python - 在 python-sphinx 中找不到 "Grammar.txt"

标签 python python-sphinx

当我尝试在 Windows 下使用 Python Sphinx 生成 html 文档时,出现以下错误:

IOError: [Errno 2] No such file or directory:
'c:\\python27\\sphinx.egg\\sphinx\\pycode\\Grammar.txt'

但是,当我打开 sphinx.egg 时,会出现文件“Grammar.txt”...

这是它提供的日志

# Sphinx version: 1.1.3
# Python version: 2.7.3
# Docutils version: 0.9.1 release
# Jinja2 version: 2.6 Traceback (most recent call last):
File "c:\python27\sphinx.egg\sphinx\cmdline.py", line 188, in main
    warningiserror, tags)   
File "c:\python27\sphinx.egg\sphinx\application.py", line 114, in __init__
    self.setup_extension(extension)
File "c:\python27\sphinx.egg\sphinx\application.py", line 247, in
setup_extension
    mod = __import__(extension, None, None, ['setup'])
File "c:\python27\sphinx.egg\sphinx\ext\autodoc.py", line 26, in <module>  
File "c:\python27\sphinx.egg\sphinx\pycode\__init__.py", line 25, in <module>
File "c:\python27\sphinx.egg\sphinx\pycode\pgen2\driver.py", line 126, in load_grammar
    g = pgen.generate_grammar(gt)
File "c:\python27\sphinx.egg\sphinx\pycode\pgen2\pgen.py", line 383, in generate_grammar
    p = ParserGenerator(filename)
File "c:\python27\sphinx.egg\sphinx\pycode\pgen2\pgen.py", line 15, in  __init__
    stream = open(filename) IOError: [Errno 2] No such file or directory: 'c:\\python27\\sphinx.egg\\sphinx\\pycode\\Grammar.txt'

有人知道为什么吗?

最佳答案

我终于找到了为什么找不到文件“Grammar.txt”。首先,我将 sphinx-quickstart.exe 移到源文件夹中。相反,最好(也是正确的方法)从其默认文件夹启动 sphinx-quickstart.exe,然后出现问题:

> Enter the root path for documentation.

> Root path for the documentation [.]: "PathToYourSourceFolder"

您在此问题中输入源文件夹路径。

希望这对某人有帮助!

关于python - 在 python-sphinx 中找不到 "Grammar.txt",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11649565/

相关文章:

python - 在 Sphinx 中禁用语法突出显示(Alabaster 主题)

python numpy left join rearray 具有重复的键值

python - 使每次调用函数时计算 Python 函数默认值

python - 使用 chunksize 的缺失记录 - Pandas 和 Google Analytics API 集成

svg - Sphinx的html输出中的svg图比例(其余)

javascript - 使用 javascript 代替 Sphinx 的默认目录树

python - 在 Python 中使用命名元组字典导致内存不足

python - NumPy - 使用强度值矩阵的图像(矩阵)阈值处理。

Sphinx 文档中的 GitHub 链接

internationalization - 在单独的目录中构建已翻译的 Sphinx 文档