123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
- ]>
- <sect1 id="ch-tools-Python" role="wrap">
- <?dbhtml filename="Python.html"?>
- <sect1info condition="script">
- <productname>Python</productname>
- <productnumber>&python-version;</productnumber>
- <address>&python-url;</address>
- </sect1info>
- <title>Python-&python-version;</title>
- <indexterm zone="ch-tools-Python">
- <primary sortas="a-Python">Python</primary>
- <secondary>tools</secondary>
- </indexterm>
- <sect2 role="package">
- <title/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
- href="../chapter06/python.xml"
- xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
- <segmentedlist>
- <segtitle>&buildtime;</segtitle>
- <segtitle>&diskspace;</segtitle>
- <seglistitem>
- <seg>&python-ch5-sbu;</seg>
- <seg>&python-ch5-du;</seg>
- </seglistitem>
- </segmentedlist>
- </sect2>
- <sect2 role="installation">
- <title>安装 Python</title>
- <note>
- <para>该软件包包含两个以
- <quote>python</quote> 开头的压缩包。我们应该解压的包是
- <filename>Python-&python-version;.tar.xz</filename>
- (注意首字母是大写的)。</para>
- </note>
- <para>该软件包首先构建 Python 解释器,然后构建一些标准 Python 模块。
- 构建模块使用的主要脚本是用 Python 语言编写的,其中包含指向宿主系统的,
- 硬编码的路径 <filename class="directory">/usr/include</filename> 和
- <filename class="directory">/usr/lib</filename>。为了避免使用它们,
- 执行命令:</para>
- <screen><userinput remap="pre">sed -i '/def add_multiarch_paths/a \ return' setup.py</userinput></screen>
- <para>准备编译 Python:</para>
- <screen><userinput remap="configure">./configure --prefix=/tools --without-ensurepip</userinput></screen>
- <variablelist>
- <title>配置选项的含义:</title>
- <varlistentry>
- <term><parameter>--without-ensurepip</parameter></term>
- <listitem>
- <para>该选项禁止构建 Python 软件包安装器,它在当前阶段没有必要。</para>
- </listitem>
- </varlistentry>
- </variablelist>
- <para>编译该软件包:</para>
- <screen><userinput remap="make">make</userinput></screen>
- <para>现在编译已经完成,但测试套件需要 Tk 和
- X 窗口系统,现在不能运行。
- </para>
- <para>安装该软件包:</para>
- <screen><userinput remap="install">make install</userinput></screen>
- </sect2>
- <sect2 role="content">
- <title/>
- <para>关于该软件包的详细信息可以在
- <xref linkend="contents-python"/> 中找到。</para>
- </sect2>
- </sect1>
|