Je générais des documents en utilisant la bibliothèque sphinx python, et je rencontre l'erreur can not import normalize
.Sphinx Erreur: Impossible d'importer normaliser en utilisant la commande "make html"
J'ai trouvé un similar question de 2014 mais cela ne résout pas mon problème.
Code d'essai
# 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 et installation Locale
import sphinx
from locale import normalize # I got no error here
print(sphinx.__version__) # 1.6.2
Sphinx commandes
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.
T sa procédure fonctionne au this youtube video.
Cependant, si je répète la même procédure, je suis l'erreur suivante:
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
drôle est quand j'importer Normaliser de locale je reçois pas d'erreur, et ne sphynx donne cette erreur.
Question
Comment pouvons-nous produire de la documentation à l'aide sphynx en évitant l'erreur d'importation?
Aide sera appréciée !!
Liens
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
Avez-vous un fichier ou un dossier appelé "locale" ou "locale.py" quelque part dans votre projet? Voir https://stackoverflow.com/a/10875148/407651 – mzjn
@mzjn Pas vraiment, il n'y a pas de locale.py. Le projet n'a qu'un fichier HELLO.PY –
Je ne sais pas comment le reproduire. Si possible, fournissez un [mcve]. – mzjn