python.xml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. <para>该软件包首先构建 Python 解释器,然后构建一些标准 Python 模块。
  36. 构建模块使用的主要脚本是用 Python 语言编写的,其中包含指向宿主系统的,
  37. 硬编码的路径 <filename class="directory">/usr/include</filename> 和
  38. <filename class="directory">/usr/lib</filename>。为了避免使用它们,
  39. 执行命令:</para>
  40. <screen><userinput remap="pre">sed -i '/def add_multiarch_paths/a \ return' setup.py</userinput></screen>
  41. <para>准备编译 Python:</para>
  42. <screen><userinput remap="configure">./configure --prefix=/tools --without-ensurepip</userinput></screen>
  43. <variablelist>
  44. <title>配置选项的含义:</title>
  45. <varlistentry>
  46. <term><parameter>--without-ensurepip</parameter></term>
  47. <listitem>
  48. <para>该选项禁止构建 Python 软件包安装器,它在当前阶段没有必要。</para>
  49. </listitem>
  50. </varlistentry>
  51. </variablelist>
  52. <para>编译该软件包:</para>
  53. <screen><userinput remap="make">make</userinput></screen>
  54. <para>现在编译已经完成,但测试套件需要 Tk 和
  55. X 窗口系统,现在不能运行。
  56. </para>
  57. <para>安装该软件包:</para>
  58. <screen><userinput remap="install">make install</userinput></screen>
  59. </sect2>
  60. <sect2 role="content">
  61. <title/>
  62. <para>关于该软件包的详细信息可以在
  63. <xref linkend="contents-python"/> 中找到。</para>
  64. </sect2>
  65. </sect1>