123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- <?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-system-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-system-Python">
- <primary sortas="a-python">python</primary>
- </indexterm>
- <sect2 role="package">
- <title/>
- <para>Python 3 软件包包含 Python 开发环境。它被用于面向对象编程、
- 编写脚本、为大型程序建立原型或开发完整的应用。</para>
- <!--para>The Python 3 package contains the Python development environment. It
- is useful for object-oriented programming, writing scripts, prototyping
- large programs or developing entire applications.</para-->
- <segmentedlist>
- <segtitle>&buildtime;</segtitle>
- <segtitle>&diskspace;</segtitle>
- <seglistitem>
- <seg>&python-ch6-sbu;</seg>
- <seg>&python-ch6-du;</seg>
- </seglistitem>
- </segmentedlist>
- </sect2>
- <sect2 role="installation">
- <title>安装 Python 3</title>
- <para>准备安装 Python:</para>
- <screen><userinput remap="configure">./configure --prefix=/usr \
- --enable-shared \
- --with-system-expat \
- --with-system-ffi \
- --with-ensurepip=yes</userinput></screen>
- <variablelist>
- <title>配置选项的含义:</title>
- <varlistentry>
- <term><parameter>--with-system-expat</parameter></term>
- <listitem>
- <para>该选项允许链接到系统已经安装的
- <application>Expat</application>。</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>--with-system-ffi</parameter></term>
- <listitem>
- <para>该选项允许链接到系统已经安装的
- <application>libffi</application>。</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>--with-ensurepip=yes</parameter></term>
- <listitem>
- <para>该选项启用 <command>pip</command> 和
- <command>setuptools</command> 包管理程序的构建。</para>
- </listitem>
- </varlistentry>
- </variablelist>
- <para>编译该软件包:</para>
- <screen><userinput remap="make">make</userinput></screen>
- <para>测试套件需要 Tk 和 X 窗口会话的支持,
- 必须在 BLFS 中重新安装 Python 3 后才能运行。</para>
- <para>安装该软件包:</para>
- <screen><userinput remap="install">make install
- chmod -v 755 /usr/lib/libpython&python-minor;m.so
- chmod -v 755 /usr/lib/libpython3.so</userinput></screen>
- <variablelist>
- <title>安装命令的含义:</title>
- <varlistentry>
- <term><command>chmod -v 755 /usr/lib/libpython3.{7m.,}so</command></term>
- <listitem>
- <para>修正库文件访问权限,使之和其他库文件一致。</para>
- </listitem>
- </varlistentry>
- </variablelist>
- <para>如果需要的话,安装预先格式化的文档:</para>
- <screen><userinput remap="install">install -v -dm755 /usr/share/doc/python-&python-version;/html
- tar --strip-components=1 \
- --no-same-owner \
- --no-same-permissions \
- -C /usr/share/doc/python-&python-version;/html \
- -xvf ../python-&python-version;-docs-html.tar.bz2</userinput></screen>
- <variablelist>
- <title>文档安装命令的含义:</title>
- <varlistentry>
- <term><option>--no-same-owner</option> 和
- <option>--no-same-permissions</option></term>
- <listitem>
- <para>保证安装的文件拥有正确的所有者和权限码。
- 在没有这些选项的时候,<application>tar</application>
- 会以上游开发者使用的用户和权限码安装文件。
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </sect2>
- <sect2 id="contents-python" role="content">
- <title>Python 3 的内容</title>
- <segmentedlist>
- <segtitle>安装的程序</segtitle>
- <segtitle>安装的库</segtitle>
- <segtitle>安装的目录</segtitle>
- <seglistitem>
- <seg>
- 2to3, idle3, pydoc3, python3, python3-config, pyvenv
- </seg>
- <seg>
- libpython&python-minor;m.so 和 libpython3.so
- </seg>
- <seg>
- /usr/include/python&python-minor;m, /usr/lib/python3 以及
- /usr/share/doc/python-&python-version;
- </seg>
- </seglistitem>
- </segmentedlist>
- <variablelist>
- <bridgehead renderas="sect3">简要描述</bridgehead>
- <?dbfo list-presentation="list"?>
- <?dbhtml list-presentation="table"?>
- <varlistentry id="python-2to3">
- <term><command>2to3</command></term>
- <listitem>
- <para>
- 是一个 <application>Python</application> 程序,读取
- <application>Python 2.x</application>
- 源代码并对它进行一系列修正,转换成合法的
- <application>Python 3.x</application> 源代码。
- </para>
- <indexterm zone="ch-system-Python">
- <primary sortas="b-2to3">2to3</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="idle3">
- <term><command>idle3</command></term>
- <listitem>
- <para>
- 一个封装脚本,启动支持 <application>Python</application>
- 语法的 GUI 文本编辑器。要运行这个脚本,必须在 Python 之前安装
- <application>Tk</application> ,从而构建 Tkinter Python 模块。
- </para>
- <indexterm zone="ch-system-Python">
- <primary sortas="b-idle3">idle3</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="pydoc3">
- <term><command>pydoc3</command></term>
- <listitem>
- <para>
- 是 <application>Python</application> 文档工具。
- </para>
- <indexterm zone="ch-system-Python">
- <primary sortas="b-pydoc3">pydoc3</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="python3">
- <term><command>python3</command></term>
- <listitem>
- <para>
- 是一个解释性、交互性、面向对象的程序设计语言
- </para>
- <indexterm zone="ch-system-Python">
- <primary sortas="b-python3">python3</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="pyvenv">
- <term><command>pyvenv</command></term>
- <listitem>
- <para>
- 在一个或多个目标目录创建 <application>Python</application>
- 虚拟环境
- </para>
- <indexterm zone="ch-system-Python">
- <primary sortas="b-pyvenv">pyvenv</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- </variablelist>
- </sect2>
- </sect1>
|