我开始为我的 lil' python/django 项目编写文档。
发生这种情况:
Running Sphinx v1.2
loading translations [en]... done
building [readthedocs]: targets for 18 source files that are out of date
updating environment: 18 added, 0 changed, 0 removed
reading sources... [ 5%] administrator-guide/customizing
reading sources... [ 11%] administrator-guide/index
reading sources... [ 16%] developer-guide/index
reading sources... [ 22%] index
reading sources... [ 27%] modules/booking
Sphinx Standard Error
Sphinx error:
'ascii' codec can't decode byte 0xef in position 475: ordinal not in range(128)
我明白了,这是一个编码问题。
但是:我的所有文件都是用 UTF-8 编码的。并且它可以在本地(Windows)运行。
这是我的modules/booking.rst 。和in this directory are my booking-module-files .
非常感谢任何帮助!
最佳答案
如PEP 0263所述,将其添加到源文件的顶部可确保它使用 utf-8 编码正常工作。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
当我在源文件的字符串文字中包含一些日语字符时,我个人遇到了这个障碍。
关于python - Sphinx 文档在本地有效,但无法阅读文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22761486/