[fcc02767] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 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 |
|
---|
| 8 | <sect1 id="ch-system-Python" role="wrap">
|
---|
| 9 | <?dbhtml filename="Python.html"?>
|
---|
| 10 |
|
---|
| 11 | <sect1info condition="script">
|
---|
| 12 | <productname>Python</productname>
|
---|
| 13 | <productnumber>&python-version;</productnumber>
|
---|
| 14 | <address>&python-url;</address>
|
---|
| 15 | </sect1info>
|
---|
| 16 |
|
---|
| 17 | <title>Python-&python-version;</title>
|
---|
| 18 |
|
---|
| 19 | <indexterm zone="ch-system-Python">
|
---|
[4798321] | 20 | <primary sortas="a-Python">Python</primary>
|
---|
[fcc02767] | 21 | </indexterm>
|
---|
| 22 |
|
---|
| 23 | <sect2 role="package">
|
---|
| 24 | <title/>
|
---|
| 25 |
|
---|
| 26 | <para>The Python 3 package contains the Python development environment. It
|
---|
| 27 | is useful for object-oriented programming, writing scripts, prototyping
|
---|
[6a156bab] | 28 | large programs, or developing entire applications.</para>
|
---|
[fcc02767] | 29 |
|
---|
| 30 | <segmentedlist>
|
---|
| 31 | <segtitle>&buildtime;</segtitle>
|
---|
| 32 | <segtitle>&diskspace;</segtitle>
|
---|
| 33 |
|
---|
| 34 | <seglistitem>
|
---|
[fb386e0] | 35 | <seg>&python-fin-sbu;</seg>
|
---|
| 36 | <seg>&python-fin-du;</seg>
|
---|
[fcc02767] | 37 | </seglistitem>
|
---|
| 38 | </segmentedlist>
|
---|
| 39 |
|
---|
| 40 | </sect2>
|
---|
| 41 |
|
---|
| 42 | <sect2 role="installation">
|
---|
| 43 | <title>Installation of Python 3</title>
|
---|
| 44 |
|
---|
| 45 | <para>Prepare Python for compilation:</para>
|
---|
| 46 |
|
---|
[5ed37b3] | 47 | <screen><userinput remap="configure">./configure --prefix=/usr \
|
---|
| 48 | --enable-shared \
|
---|
| 49 | --with-system-expat \
|
---|
| 50 | --with-system-ffi \
|
---|
| 51 | --enable-optimizations</userinput></screen>
|
---|
[fcc02767] | 52 |
|
---|
| 53 | <variablelist>
|
---|
| 54 | <title>The meaning of the configure options:</title>
|
---|
| 55 |
|
---|
| 56 | <varlistentry>
|
---|
| 57 | <term><parameter>--with-system-expat</parameter></term>
|
---|
| 58 | <listitem>
|
---|
| 59 | <para>This switch enables linking against system version of
|
---|
| 60 | <application>Expat</application>.</para>
|
---|
| 61 | </listitem>
|
---|
| 62 | </varlistentry>
|
---|
| 63 |
|
---|
| 64 | <varlistentry>
|
---|
| 65 | <term><parameter>--with-system-ffi</parameter></term>
|
---|
| 66 | <listitem>
|
---|
| 67 | <para>This switch enables linking against system version of
|
---|
| 68 | <application>libffi</application>.</para>
|
---|
| 69 | </listitem>
|
---|
| 70 | </varlistentry>
|
---|
| 71 |
|
---|
[5ed37b3] | 72 | <varlistentry>
|
---|
| 73 | <term><parameter>--enable-optimizations</parameter></term>
|
---|
| 74 | <listitem>
|
---|
| 75 | <para>This switch enables stable, but expensive, optimizations.</para>
|
---|
| 76 | </listitem>
|
---|
| 77 | </varlistentry>
|
---|
| 78 |
|
---|
[fcc02767] | 79 | </variablelist>
|
---|
| 80 |
|
---|
| 81 | <para>Compile the package:</para>
|
---|
| 82 |
|
---|
| 83 | <screen><userinput remap="make">make</userinput></screen>
|
---|
| 84 |
|
---|
[5ed37b3] | 85 | <para>Running the tests at this point is not recommended. The
|
---|
| 86 | tests are known to hang indefinitely in the partial LFS environment.
|
---|
| 87 | If desired, the tests can be rerun at the end of this chapter or
|
---|
| 88 | when Python 3 is reinstalled in BLFS. To run the tests anyway,
|
---|
| 89 | issue <command>make test</command>.</para>
|
---|
[fcc02767] | 90 |
|
---|
| 91 | <para>Install the package:</para>
|
---|
| 92 |
|
---|
[3cf8a59] | 93 | <screen><userinput remap="install">make install</userinput></screen>
|
---|
[fcc02767] | 94 |
|
---|
[e953813] | 95 | <para>In serveral places we use the <command>pip3</command> command to
|
---|
| 96 | install Python 3 programs and modules for all users as root. This conflicts
|
---|
| 97 | with the Python developers recommendation to build packages in a virtual
|
---|
| 98 | environment as a regular user. To this end, a multi-line warning is
|
---|
| 99 | written when using <command>pip3</command> as the root user. If desired,
|
---|
| 100 | supress this warning by running the following command:</para>
|
---|
| 101 |
|
---|
| 102 | <screen><userinput remap="install">sed -e '/def warn_if_run_as_root/a\ return' \
|
---|
| 103 | -i /usr/lib/python3.10/site-packages/pip/_internal/cli/req_command.py
|
---|
| 104 | </userinput></screen>
|
---|
| 105 |
|
---|
| 106 |
|
---|
[fcc02767] | 107 | <para>If desired, install the preformatted documentation:</para>
|
---|
| 108 |
|
---|
[d672ab7] | 109 | <screen><userinput remap="install">install -v -dm755 /usr/share/doc/python-&python-version;/html
|
---|
[fcc02767] | 110 |
|
---|
| 111 | tar --strip-components=1 \
|
---|
| 112 | --no-same-owner \
|
---|
| 113 | --no-same-permissions \
|
---|
| 114 | -C /usr/share/doc/python-&python-version;/html \
|
---|
| 115 | -xvf ../python-&python-version;-docs-html.tar.bz2</userinput></screen>
|
---|
| 116 |
|
---|
| 117 | <variablelist>
|
---|
| 118 | <title>The meaning of the documentation install commands:</title>
|
---|
| 119 |
|
---|
| 120 | <varlistentry>
|
---|
| 121 | <term><option>--no-same-owner</option> and <option>--no-same-permissions</option></term>
|
---|
| 122 | <listitem>
|
---|
[d672ab7] | 123 | <para>Ensure the installed files have the correct ownership and
|
---|
[fcc02767] | 124 | permissions. Without these options, using <application>tar</application>
|
---|
[d672ab7] | 125 | will install the package files with the upstream creator's values.
|
---|
[fcc02767] | 126 | </para>
|
---|
| 127 | </listitem>
|
---|
| 128 | </varlistentry>
|
---|
| 129 |
|
---|
| 130 | </variablelist>
|
---|
| 131 |
|
---|
| 132 | </sect2>
|
---|
| 133 |
|
---|
| 134 | <sect2 id="contents-python" role="content">
|
---|
| 135 | <title>Contents of Python 3</title>
|
---|
| 136 |
|
---|
| 137 | <segmentedlist>
|
---|
| 138 | <segtitle>Installed Programs</segtitle>
|
---|
| 139 | <segtitle>Installed Library</segtitle>
|
---|
| 140 | <segtitle>Installed Directories</segtitle>
|
---|
| 141 |
|
---|
| 142 | <seglistitem>
|
---|
| 143 | <seg>
|
---|
| 144 | 2to3, idle3, pip3, pydoc3, python3, and python3-config
|
---|
| 145 | </seg>
|
---|
| 146 | <seg>
|
---|
| 147 | libpython&python-minor;.so and libpython3.so
|
---|
| 148 | </seg>
|
---|
| 149 | <seg>
|
---|
[d672ab7] | 150 | /usr/include/python&python-minor;,
|
---|
[fcc02767] | 151 | /usr/lib/python3, and
|
---|
| 152 | /usr/share/doc/python-&python-version;
|
---|
| 153 | </seg>
|
---|
| 154 | </seglistitem>
|
---|
| 155 | </segmentedlist>
|
---|
| 156 |
|
---|
| 157 | <variablelist>
|
---|
| 158 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 159 | <?dbfo list-presentation="list"?>
|
---|
| 160 | <?dbhtml list-presentation="table"?>
|
---|
| 161 |
|
---|
| 162 | <varlistentry id="python-2to3">
|
---|
| 163 | <term><command>2to3</command></term>
|
---|
| 164 | <listitem>
|
---|
| 165 | <para>
|
---|
| 166 | is a <application>Python</application> program that reads
|
---|
| 167 | <application>Python 2.x</application> source code and applies a
|
---|
[d672ab7] | 168 | series of fixes to transform it into
|
---|
[8d35535] | 169 | valid <application>Python 3.x</application> code
|
---|
[fcc02767] | 170 | </para>
|
---|
| 171 | <indexterm zone="ch-system-Python">
|
---|
| 172 | <primary sortas="b-2to3">2to3</primary>
|
---|
| 173 | </indexterm>
|
---|
| 174 | </listitem>
|
---|
| 175 | </varlistentry>
|
---|
| 176 |
|
---|
| 177 | <varlistentry id="idle3">
|
---|
| 178 | <term><command>idle3</command></term>
|
---|
| 179 | <listitem>
|
---|
| 180 | <para>
|
---|
| 181 | is a wrapper script that opens a <application>Python</application>
|
---|
| 182 | aware GUI editor. For this script to run, you must have installed
|
---|
| 183 | <application>Tk</application> before Python so that the Tkinter
|
---|
[8d35535] | 184 | Python module is built
|
---|
[fcc02767] | 185 | </para>
|
---|
| 186 | <indexterm zone="ch-system-Python">
|
---|
| 187 | <primary sortas="b-idle3">idle3</primary>
|
---|
| 188 | </indexterm>
|
---|
| 189 | </listitem>
|
---|
| 190 | </varlistentry>
|
---|
| 191 |
|
---|
| 192 | <varlistentry id="pip3">
|
---|
| 193 | <term><command>pip3</command></term>
|
---|
| 194 | <listitem>
|
---|
| 195 | <para>
|
---|
| 196 | The package installer for Python. You can use pip to install
|
---|
[8d35535] | 197 | packages from Python Package Index and other indexes
|
---|
[fcc02767] | 198 | </para>
|
---|
| 199 | <indexterm zone="ch-system-Python">
|
---|
| 200 | <primary sortas="b-pip3">pip3</primary>
|
---|
| 201 | </indexterm>
|
---|
| 202 | </listitem>
|
---|
| 203 | </varlistentry>
|
---|
| 204 |
|
---|
| 205 | <varlistentry id="pydoc3">
|
---|
| 206 | <term><command>pydoc3</command></term>
|
---|
| 207 | <listitem>
|
---|
| 208 | <para>
|
---|
[8d35535] | 209 | is the <application>Python</application> documentation tool
|
---|
[fcc02767] | 210 | </para>
|
---|
| 211 | <indexterm zone="ch-system-Python">
|
---|
| 212 | <primary sortas="b-pydoc3">pydoc3</primary>
|
---|
| 213 | </indexterm>
|
---|
| 214 | </listitem>
|
---|
| 215 | </varlistentry>
|
---|
| 216 |
|
---|
| 217 | <varlistentry id="python3">
|
---|
| 218 | <term><command>python3</command></term>
|
---|
| 219 | <listitem>
|
---|
| 220 | <para>
|
---|
| 221 | is an interpreted, interactive, object-oriented programming
|
---|
[8d35535] | 222 | language
|
---|
[fcc02767] | 223 | </para>
|
---|
| 224 | <indexterm zone="ch-system-Python">
|
---|
| 225 | <primary sortas="b-python3">python3</primary>
|
---|
| 226 | </indexterm>
|
---|
| 227 | </listitem>
|
---|
| 228 | </varlistentry>
|
---|
[6a156bab] | 229 |
|
---|
[fcc02767] | 230 | </variablelist>
|
---|
| 231 |
|
---|
| 232 | </sect2>
|
---|
| 233 |
|
---|
| 234 | </sect1>
|
---|
| 235 |
|
---|