Differences between revisions 10 and 21 (spanning 11 versions)
Revision 10 as of 2008-12-16 16:20:40
Size: 2846
Editor: ZoomQuiet
Comment:
Revision 21 as of 2009-12-25 07:14:41
Size: 3455
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
[[TableOfContents]] <<TableOfContents>>
Line 6: Line 6:
[[Include(ZPyUGnav)]] <<Include(ZPyUGnav)>>
Line 21: Line 21:
  * [http://www.python.org/download/ Download Python Software] 下载源代码包!   * [[http://www.python.org/download/|Download Python Software]] 下载源代码包!
Line 23: Line 23:
  1. 配置 attachment:configure_py.png   1. 配置 {{attachment:configure_py.png}}
Line 25: Line 25:
  1. `$ make` attachment:make_py.png   1. `$ make` {{attachment:make_py.png}}
Line 30: Line 30:
  * attachment:make_options.png
  * 一般使用 `$ make dist` ~ 制作本地发行版~将 HTML页面组织成和 http://docs.python.org 一样的网站!
  * attachment:make_dist.png
  * {{attachment:make_options.png}}
  * 一般使用 `$ make dist` ~ 制作本地发行版~将输出所有可以输出的!包括压缩包下载的,,,
   * {{attachment:make_dist.png}}
  * 所以,建议使用 `$ make html` ~ 就编译出
HTML页面组织成和 http://docs.python.org 一样的网站!
   * {{attachment:make_html.png}}
Line 37: Line 39:
 * {{attachment:zh_pydocs.png}}
Line 43: Line 46:
 081217 Zoom,Quiet::
  * 编译后,`不是根据下载的源代码包版本来输出文档,一直是 2.5.2 版本?!`
  * 经过测试,确认是使用了`ln -s`导致make 时调用的系统库不同;
  * 更新编译帮助文档,建议在源代码目录树中进行编译!
Line 44: Line 51:
  1. attachment:makedist-error.png
   * [http://groups.google.com/group/sphinx-dev/browse_thread/thread/f7b54b9ca208528a error building Python 2.6.1 documentation ]^- sphinx-dev | Google 网上论坛^ 有解决
  1. 编译时有模块丢失
   * {{
attachment:makedist-error.png}}
   * [[http://groups.google.com/group/sphinx-dev/browse_thread/thread/f7b54b9ca208528a|error building Python 2.6.1 documentation ]]^- sphinx-dev | Google 网上论坛^ 有解决
Line 47: Line 55:
{{{
svn co http://svn.python.org/projects/python/trunk python-svn
}}}
    * `$ svn co http://svn.python.org/projects/python/trunk python-svn`
Line 51: Line 57:
 1. attachment:make_tutorial_error.png
  *
发现使用 [http://openbookproject.googlecode.com/svn/trunk/docs.py_zh/PyTutorial_zh/2.6/ PyTutorial_zh/2.6]^Revision 2067^的会编译时失败!
  1. 发现使用 [[http://openbookproject.googlecode.com/svn/trunk/docs.py_zh/PyTutorial_zh/2.6/|PyTutorial_zh/2.6]]^Revision 2067^的会编译时失败!
   * {{attachment:make_tutorial_error.png}}
   * 继续尝试确认
    1. `errors.rst` 也无法编译过,,
    1. `inputoutput.rst:3: (SEVERE/4) Title overline & underline mismatch`
Line 56: Line 65:
创建 by -- MarchLiu [[[DateTime(2008-12-04T14:14:24Z)]]]
||<^>[[PageComment2]]||<^>[:/PageCommentData:PageCommentData]''||
创建 by -- MarchLiu [<<DateTime(2008-12-04T14:14:24Z)>>]

编译Python 2.6 文档

适用范围

理论上讲本方法适用于所有(自Python 2.5起)使用reST格式发布的Python官方文档。不过我没有在Python 2.5环境下试过,目前Python 3.0和在翻译中的Python 2.6的Tutorial都是用这个方法生成的。

本文只适用于 *nix 环境,在Windows上没有经过测试。

编译方法

准备

  • 无论你想编译哪一版的文档,将完整的Python源码从官网上下载下来,找一个目录,解压。
  • 编译Python,是的,你没看错,编译整个Python,在它的目录下就有 configure 和 MakeFile,像普通项目那样配置编译就好,但是不需要安装。

    1. 配置 configure_py.png

      • 一般说只要基础环境靠谱,或是以编辑方式安装过软件,配置都会很快过去的,,,
    2. $ make make_py.png

编译

  • 进入 Doc 目录,你会看到另一个 MakeFile。如果你直接make。它会提示你需要指定格式,可选的有html、pdf、latex等等。

  • OK,选你需要的,编译就好了。pdf版实际上是用latex再编译成pdf,我没找到MakeFile中指定的工具,就没有去做它。

    • make_options.png

    • 一般使用 $ make dist ~ 制作本地发行版~将输出所有可以输出的!包括压缩包下载的,,,

      • make_dist.png

    • 所以,建议使用 $ make html ~ 就编译出 HTML页面组织成和 http://docs.python.org 一样的网站!

      • make_html.png

自个儿的版本

如果你需要编译一份简体中文版的Tutorial,只要把简体中文版文档的rst文件,覆盖到相应的目录下。回到Doc目录,make html(或其它你想要生成的格式)。就可以啦。

  • zh_pydocs.png

文档版本

反馈

081217 Zoom,Quiet
  • 编译后,不是根据下载的源代码包版本来输出文档,一直是 2.5.2 版本?!

  • 经过测试,确认是使用了ln -s导致make 时调用的系统库不同;

  • 更新编译帮助文档,建议在源代码目录树中进行编译!
081216 Zoom,Quiet
  1. 编译时有模块丢失
    • makedist-error.png

    • error building Python 2.6.1 documentation- sphinx-dev | Google 网上论坛 有解决

    • 我们得输出男人版本Python:
      • $ svn co http://svn.python.org/projects/python/trunk python-svn

    • 然后将Doc/tools/sphinxext 复制到当前编译文档的 Python-2.6.1/Doc/tools 中就好

  2. 发现使用 PyTutorial_zh/2.6Revision 2067的会编译时失败!

    • make_tutorial_error.png

    • 继续尝试确认
      1. errors.rst 也无法编译过,,

      2. inputoutput.rst:3: (SEVERE/4) Title overline & underline mismatch


创建 by -- MarchLiu [2008-12-04 14:14:24]

HowToCompliePythonDocument (last edited 2009-12-25 07:14:41 by localhost)