Intersphinx links to python 2 docs even with python 3 in intersphinx

I am building docs with sphinx (Sphinx==1.7.0) using the intersphinx extension. I noticed that it was linking to python 2 docs by default, but I preferred linking to python 3 docs, so I changed the intersphinx_mapping in my conf.py to the following:

# conf.py
...
intersphinx_mapping = {
    'python': ('https://docs.python.org/3/': None),
}
...

However, when I make references in my source files to python objects, I see that these still link by default to python 2. I can fix this if I prefix str so that it reads python:str (as described in the docs), which explicitly indicates which intersphinx mapping to use. For example:

# index.rst
:any:`str`         # surprisingly, this links to https://docs.python.org/2/library/functions.html#str
:any:`python:str`  # as expected, this links to https://docs.python.org/3/library/stdtypes.html#str

For reference, this is what the docs say:

When using the “new” format (see below), you can even force lookup in a foreign set by prefixing the link target appropriately. A link like :ref: comparison manual <python:comparisons> will then link to the label “comparisons” in the doc set “python”, if it exists.

My question is this: how can I make the default, unqualified intersphinx links point to python 3 docs instead of python 2 docs?

链接地址: http://www.djcxy.com/p/75504.html

上一篇: 将狮身人面像TOC分成小节和小标题

下一篇: Intersphinx甚至可以在intersphinx中使用python 3链接到python 2文档