1
0

python.xml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-tools-Python" role="wrap">
  8. <?dbhtml filename="Python.html"?>
  9. <sect1info condition="script">
  10. <productname>Python</productname>
  11. <productnumber>&python-version;</productnumber>
  12. <address>&python-url;</address>
  13. </sect1info>
  14. <title>Python-&python-version;</title>
  15. <indexterm zone="ch-tools-Python">
  16. <primary sortas="a-Python">Python</primary>
  17. <secondary>tools</secondary>
  18. </indexterm>
  19. <sect2 role="package">
  20. <title/>
  21. <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
  22. href="../chapter06/python.xml"
  23. xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
  24. <segmentedlist>
  25. <segtitle>&buildtime;</segtitle>
  26. <segtitle>&diskspace;</segtitle>
  27. <seglistitem>
  28. <seg>&python-ch5-sbu;</seg>
  29. <seg>&python-ch5-du;</seg>
  30. </seglistitem>
  31. </segmentedlist>
  32. </sect2>
  33. <sect2 role="installation">
  34. <title>安装 Python</title>
  35. <note>
  36. <para>该软件包包含两个以
  37. <quote>python</quote> 开头的压缩包。我们应该解压的包是
  38. <filename>Python-&python-version;.tar.xz</filename>
  39. (注意首字母是大写的)。</para>
  40. </note>
  41. <para>该软件包首先构建 Python 解释器,然后构建一些标准 Python 模块。
  42. 构建模块使用的主要脚本是用 Python 语言编写的,其中包含指向宿主系统的,
  43. 硬编码的路径 <filename class="directory">/usr/include</filename> 和
  44. <filename class="directory">/usr/lib</filename>。为了避免使用它们,
  45. 执行命令:</para>
  46. <screen><userinput remap="pre">sed -i '/def add_multiarch_paths/a \ return' setup.py</userinput></screen>
  47. <para>准备编译 Python:</para>
  48. <screen><userinput remap="configure">./configure --prefix=/tools --without-ensurepip</userinput></screen>
  49. <variablelist>
  50. <title>配置选项的含义:</title>
  51. <varlistentry>
  52. <term><parameter>--without-ensurepip</parameter></term>
  53. <listitem>
  54. <para>该选项禁止构建 Python 软件包安装器,它在当前阶段没有必要。</para>
  55. </listitem>
  56. </varlistentry>
  57. </variablelist>
  58. <para>编译该软件包:</para>
  59. <screen><userinput remap="make">make</userinput></screen>
  60. <para>现在编译已经完成,但测试套件需要 Tk 和
  61. X 窗口系统,现在不能运行。
  62. </para>
  63. <para>安装该软件包:</para>
  64. <screen><userinput remap="install">make install</userinput></screen>
  65. </sect2>
  66. <sect2 role="content">
  67. <title/>
  68. <para>关于该软件包的详细信息可以在
  69. <xref linkend="contents-python"/> 中找到。</para>
  70. </sect2>
  71. </sect1>