Python sphinx 如何使用Sphinx创建指向外部文件节的链接?

Python sphinx 如何使用Sphinx创建指向外部文件节的链接?,python-sphinx,Python Sphinx,我想创建一个链接,该链接引用另一个文件中定义的节 我在“”上发现了一个类似的问题,我注意到有一个扩展名为“intersphinx”。 所以我尝试了这个扩展,但它不起作用(可能我的用法是错误的) 我试过以下方法 conf.py extensions = ['sphinx.ext.todo', 'sphinx.ext.intersphinx'] ... intersphinx_mapping = {'myproject': ('../build/html', None)} 福斯特 ... ****

我想创建一个链接,该链接引用另一个文件中定义的节

我在“”上发现了一个类似的问题,我注意到有一个扩展名为“intersphinx”。 所以我尝试了这个扩展,但它不起作用(可能我的用法是错误的)

我试过以下方法

conf.py

extensions = ['sphinx.ext.todo', 'sphinx.ext.intersphinx']
...
intersphinx_mapping = {'myproject': ('../build/html', None)}
福斯特

...
****************
Install Bar
****************
Please refer :ref:`Bar Installation Instruction<myproject:bar_installation>`
当我运行
makehtml
时,我得到以下警告,并且链接没有创建

foo.rst: WARNING: undefined label: myproject:bar_installation (if the link has no caption the label must precede a section header)

提前感谢。

似乎无法找到您的映射清单文件。元组的第一部分用作链接的基本URL,而第二部分是目录文件的路径。我相信清单文件的自动下载(当您通过
None
时)只适用于URI,而不适用于文件路径

在本例中,我可以在本地构建文档,但它将链接到
http://example.com/docs/bar.html

'myproject': (
    'http://example.com/docs/',
    '../html/objects.inv'
)
'myproject': (
    'http://example.com/docs/',
    '../html/objects.inv'
)