Sphinx Error: Can not import normalize while using command "make html"

Sphinx Error: Can not import normalize while using command "make html"

我正在使用 sphinx python 库生成文档,我遇到了 can not import normalize 错误。

我找到了 2014 年的 similar question,但它没有解决我的问题。

测试代码

# hello.py
def myadd(a,b):
    """


        Parameters
    ----------
    a: first parameter
    b: second paramter


    Returns
    -------
    Return: Sum of two arguments

    """
    return a+b

if __name__=="__main__":
     a = myadd(5,6) 
     print('\n')
     print(a)

Sphinx 和语言环境安装

import sphinx
from locale import normalize # I got no error here
print(sphinx.__version__) # 1.6.2

斯芬克斯命令

sphinx-quickstart
> Project name: a
> Author name(s): a
> Create Makefile? (y/n) [y]: 
> Create Windows command file? (y/n) [y]: n
this creates THREE files and THREE folders.
Then,

make html # this gives the error.

此程序适用于 this youtube video

但是,如果我重复同样的步骤,我会得到以下错误:

File "/usr/lib/python2.7/gettext.py", line 440, in find
    for nelang in _expand_lang(lang):
  File "/usr/lib/python2.7/gettext.py", line 133, in _expand_lang
    from locale import normalize
ImportError: cannot import name normalize
Makefile:20: recipe for target 'html' failed
make: *** [html] Error 1

有趣的是,当我从 locale 导入 normalize 时,我没有收到任何错误,并且 只有狮身人面像给出了这个错误。

问题
我们如何通过避免导入错误使用 sphinx 生成文档?

不胜感激!!

相关链接
http://www.sphinx-doc.org/en/stable/tutorial.html http://www.sphinx-doc.org/en/stable/ext/example_google.html

https://thomas-cokelaer.info/tutorials/sphinx/docstring_python.html
http://gisellezeno.com/tutorials/sphinx-for-python-documentation.html

我安装了两个不同的 Python,即 python2 和 python3。 两者都有模块 sphinx 并且不知何故它们混合在一起并给出了问题。现在我所做的是:

ls /Library/Frameworks/Python.framework/Versions/3.6
sudo rm -rf /Library/Frameworks/Python.framework/Versions/3.6
ls "/Applications/Python/3.6
sudo rm -rf "/Applications/Python/3.6

从 anaconda 下载并安装图形 python3 安装程序。
然后它没有任何问题。