[52d29f7] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[6732c094] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[52d29f7] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
[2cee003] | 7 | <!ENTITY python3-download-http
|
---|
[3f89ec5] | 8 | "https://www.python.org/ftp/python/&python3-version;/Python-&python3-version;.tar.xz">
|
---|
[355495ce] | 9 | <!ENTITY python3-download-ftp " ">
|
---|
[73353e7f] | 10 | <!ENTITY python3-md5sum "93df27aec0cd18d6d42173e601ffbbfd">
|
---|
[d373629] | 11 | <!ENTITY python3-size "16 MB">
|
---|
[73353e7f] | 12 | <!ENTITY python3-buildsize "177 MB (add 26 MB for tests)">
|
---|
| 13 | <!ENTITY python3-time "0.9 SBU (add 1.4 SBU for tests)">
|
---|
[e882fc37] | 14 | <!--
|
---|
[73353e7f] | 15 |
|
---|
| 16 | Note: Size does not reflect docs that were install in LFS.
|
---|
| 17 |
|
---|
[2cee003] | 18 | <!ENTITY python3htmldoc-download-http
|
---|
[e882fc37] | 19 | "https://docs.python.org/ftp/python/doc/&python3-version;/python-&python3-version;-docs-html.tar.bz2"> -->
|
---|
[52d29f7] | 20 | ]>
|
---|
| 21 |
|
---|
[b88be39] | 22 | <sect1 id="python3" xreflabel="Python-&python3-version;">
|
---|
| 23 | <?dbhtml filename="python3.html" ?>
|
---|
[83f69e5d] | 24 |
|
---|
| 25 | <sect1info>
|
---|
| 26 | <othername>$LastChangedBy$</othername>
|
---|
| 27 | <date>$Date$</date>
|
---|
| 28 | </sect1info>
|
---|
| 29 |
|
---|
[b88be39] | 30 | <title>Python-&python3-version;</title>
|
---|
[83f69e5d] | 31 |
|
---|
[b88be39] | 32 | <indexterm zone="python3">
|
---|
[03d30cf] | 33 | <primary sortas="a-Python3">Python3</primary>
|
---|
[83f69e5d] | 34 | </indexterm>
|
---|
| 35 |
|
---|
| 36 | <sect2 role="package">
|
---|
[03d30cf] | 37 | <title>Introduction to Python 3</title>
|
---|
[83f69e5d] | 38 |
|
---|
[355495ce] | 39 | <para>
|
---|
[03d30cf] | 40 | The <application>Python 3</application> package contains the
|
---|
[355495ce] | 41 | <application>Python</application> development environment.
|
---|
| 42 | This is useful for object-oriented programming, writing scripts,
|
---|
| 43 | prototyping large programs or developing entire applications.
|
---|
| 44 | </para>
|
---|
[48b816cb] | 45 |
|
---|
[60ddbaf] | 46 | <note><para><application>Python 3</application> was installed in LFS.
|
---|
| 47 | The only reason to rebuild it here is if optional modules
|
---|
| 48 | are needed.</para></note>
|
---|
| 49 |
|
---|
[ba4e992] | 50 | &lfs84_checked;
|
---|
[48b816cb] | 51 |
|
---|
[83f69e5d] | 52 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 53 | <itemizedlist spacing="compact">
|
---|
| 54 | <listitem>
|
---|
[355495ce] | 55 | <para>
|
---|
| 56 | Download (HTTP): <ulink url="&python3-download-http;"/>
|
---|
| 57 | </para>
|
---|
[83f69e5d] | 58 | </listitem>
|
---|
| 59 | <listitem>
|
---|
[355495ce] | 60 | <para>
|
---|
| 61 | Download (FTP): <ulink url="&python3-download-ftp;"/>
|
---|
| 62 | </para>
|
---|
[83f69e5d] | 63 | </listitem>
|
---|
| 64 | <listitem>
|
---|
[355495ce] | 65 | <para>
|
---|
| 66 | Download MD5 sum: &python3-md5sum;
|
---|
| 67 | </para>
|
---|
[83f69e5d] | 68 | </listitem>
|
---|
| 69 | <listitem>
|
---|
[355495ce] | 70 | <para>
|
---|
| 71 | Download size: &python3-size;
|
---|
| 72 | </para>
|
---|
[83f69e5d] | 73 | </listitem>
|
---|
| 74 | <listitem>
|
---|
[355495ce] | 75 | <para>
|
---|
| 76 | Estimated disk space required: &python3-buildsize;
|
---|
| 77 | </para>
|
---|
[83f69e5d] | 78 | </listitem>
|
---|
| 79 | <listitem>
|
---|
[355495ce] | 80 | <para>
|
---|
| 81 | Estimated build time: &python3-time;
|
---|
| 82 | </para>
|
---|
[83f69e5d] | 83 | </listitem>
|
---|
| 84 | </itemizedlist>
|
---|
[e882fc37] | 85 |
|
---|
[03d30cf] | 86 | <bridgehead renderas="sect3">Python 3 Dependencies</bridgehead>
|
---|
[e882fc37] | 87 |
|
---|
[83f69e5d] | 88 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[355495ce] | 89 | <para role="optional">
|
---|
[7fe0ce3b] | 90 | <xref linkend="bluez"/>,
|
---|
[e882fc37] | 91 | <xref linkend="gdb"/> (required for some tests),
|
---|
| 92 | <xref linkend="valgrind"/>, and
|
---|
| 93 | <ulink url="http://www.bytereef.org/mpdecimal">libmpcdec</ulink>
|
---|
[355495ce] | 94 | </para>
|
---|
| 95 |
|
---|
| 96 | <bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
|
---|
| 97 | <para role="optional">
|
---|
[94b42903] | 98 | <xref linkend="db"/> and
|
---|
[dbc530b] | 99 | <xref linkend="sqlite"/>
|
---|
[355495ce] | 100 | </para>
|
---|
[ce33273] | 101 |
|
---|
[1039de3] | 102 | <para condition="html" role="usernotes">User Notes:
|
---|
[355495ce] | 103 | <ulink url="&blfs-wiki;/Python3"/>
|
---|
| 104 | </para>
|
---|
[83f69e5d] | 105 | </sect2>
|
---|
| 106 |
|
---|
| 107 | <sect2 role="installation">
|
---|
[03d30cf] | 108 | <title>Installation of Python 3</title>
|
---|
[83f69e5d] | 109 |
|
---|
[355495ce] | 110 | <para>
|
---|
[03d30cf] | 111 | Install <application>Python 3</application> by running the following
|
---|
[355495ce] | 112 | commands:
|
---|
| 113 | </para>
|
---|
[83f69e5d] | 114 |
|
---|
[fd69a62] | 115 | <screen><userinput>CXX="/usr/bin/g++" \
|
---|
| 116 | ./configure --prefix=/usr \
|
---|
[c525bd1] | 117 | --enable-shared \
|
---|
[355495ce] | 118 | --with-system-expat \
|
---|
[fd69a62] | 119 | --with-system-ffi \
|
---|
[879932f] | 120 | --with-ensurepip=yes &&
|
---|
[83f69e5d] | 121 | make</userinput></screen>
|
---|
| 122 |
|
---|
[355495ce] | 123 | <para>
|
---|
[7fe0ce3b] | 124 | The test suite must be run separately, using an X terminal (see below).
|
---|
[355495ce] | 125 | </para>
|
---|
| 126 |
|
---|
| 127 | <para>
|
---|
| 128 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 129 | </para>
|
---|
| 130 |
|
---|
[82fac2c] | 131 | <screen role="root"><userinput>make install &&
|
---|
[c525bd1] | 132 | chmod -v 755 /usr/lib/libpython&python3-majorver;m.so &&
|
---|
[355495ce] | 133 | chmod -v 755 /usr/lib/libpython3.so</userinput></screen>
|
---|
[1970f00] | 134 |
|
---|
[7fe0ce3b] | 135 | <para>
|
---|
| 136 | The test suite must be run separately from the build, either before or
|
---|
[7745345d] | 137 | after the package is built and installed. Do not run
|
---|
[af8a78d] | 138 | <command>make install</command> after running the test suite. To build
|
---|
[7745345d] | 139 | and install the package, you need to start with a fresh or clean source
|
---|
[e882fc37] | 140 | tree. For the tests, you also need a clean source code, so either start by
|
---|
[7745345d] | 141 | removing the source code directory and starting over, by uncompressing
|
---|
| 142 | the source tarball or by running <command>make clean</command>. Then
|
---|
| 143 | configure again, adding <quote>--with-pydebug</quote> to the
|
---|
| 144 | <command>configure</command> switches above, run <command>make</command>,
|
---|
[d7d743f0] | 145 | then <command>make test</command>. Remember that tests must be executed
|
---|
[73353e7f] | 146 | using an X terminal.
|
---|
| 147 | The test SBU highly depends on the speed of the internet connection.
|
---|
[7fe0ce3b] | 148 | </para>
|
---|
| 149 |
|
---|
[879d269] | 150 | </sect2>
|
---|
| 151 |
|
---|
| 152 | <sect2 role="commands">
|
---|
| 153 | <title>Command Explanations</title>
|
---|
| 154 |
|
---|
[fd69a62] | 155 | <para>
|
---|
| 156 | <command> CXX="/usr/bin/g++" ./configure ...</command>: Avoid an annoying
|
---|
| 157 | message during configuration.
|
---|
| 158 | </para>
|
---|
| 159 |
|
---|
[355495ce] | 160 | <para>
|
---|
[f1d7196] | 161 | <parameter>--with-system-expat</parameter>: This switch enables linking
|
---|
| 162 | against the system version of <application>Expat</application>.
|
---|
[355495ce] | 163 | </para>
|
---|
| 164 |
|
---|
| 165 | <para>
|
---|
[f1d7196] | 166 | <parameter>--with-system-ffi</parameter>: This switch enables linking
|
---|
[60ddbaf] | 167 | against system version of <application>libffi</application>.
|
---|
[82fac2c] | 168 | </para>
|
---|
[fd69a62] | 169 |
|
---|
| 170 | <para>
|
---|
[23c5563] | 171 | <parameter>--with-ensurepip=yes</parameter> : This switch enables building
|
---|
| 172 | <command>pip</command> and <command>setuptools</command> packaging programs.
|
---|
| 173 | <command>setuptools</command> is needed for building some Python modules.
|
---|
[fd69a62] | 174 | </para>
|
---|
[82fac2c] | 175 |
|
---|
[f1d7196] | 176 | <para>
|
---|
| 177 | <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
|
---|
| 178 | if you want to build <application>Python</application> DBM Module
|
---|
| 179 | against <application>Berkeley DB</application> instead of
|
---|
| 180 | <application>GDBM</application>.
|
---|
| 181 | </para>
|
---|
| 182 |
|
---|
[355495ce] | 183 | <para>
|
---|
[0d7900a] | 184 | <command>chmod ...</command>: Fix permissions for shared libraries to be
|
---|
[355495ce] | 185 | consistent with other libraries.
|
---|
| 186 | </para>
|
---|
[7224506] | 187 |
|
---|
[879d269] | 188 | </sect2>
|
---|
| 189 |
|
---|
| 190 | <sect2 role="configuration">
|
---|
[03d30cf] | 191 | <title>Configuring Python 3</title>
|
---|
[879d269] | 192 |
|
---|
[355495ce] | 193 | <para>
|
---|
[03d30cf] | 194 | In order for <command>python3</command> to find the installed
|
---|
[d7015e7] | 195 | documentation, create the following version independent symlink:
|
---|
[355495ce] | 196 | </para>
|
---|
[1970f00] | 197 |
|
---|
[d7015e7] | 198 | <screen role="root"><userinput>ln -svfn python-&python3-version; /usr/share/doc/python-3</userinput></screen>
|
---|
| 199 |
|
---|
| 200 | <para>
|
---|
| 201 | and add the following environment variable to the individual user's or
|
---|
| 202 | system's profile:
|
---|
| 203 | </para>
|
---|
| 204 |
|
---|
| 205 | <screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-3/html</userinput></screen>
|
---|
[83f69e5d] | 206 |
|
---|
| 207 | </sect2>
|
---|
| 208 |
|
---|
| 209 | <sect2 role="content">
|
---|
| 210 | <title>Contents</title>
|
---|
| 211 |
|
---|
| 212 | <segmentedlist>
|
---|
| 213 | <segtitle>Installed Programs</segtitle>
|
---|
| 214 | <segtitle>Installed Libraries</segtitle>
|
---|
| 215 | <segtitle>Installed Directories</segtitle>
|
---|
| 216 |
|
---|
| 217 | <seglistitem>
|
---|
[355495ce] | 218 | <seg>
|
---|
[7fe0ce3b] | 219 | 2to3 (symlink),
|
---|
[355495ce] | 220 | 2to3-&python3-majorver;,
|
---|
| 221 |
|
---|
[f5c5306] | 222 | idle3 (symlink), and
|
---|
| 223 | idle&python3-majorver;
|
---|
| 224 |
|
---|
[7fe0ce3b] | 225 | pydoc3 (symlink),
|
---|
[355495ce] | 226 | pydoc&python3-majorver;,
|
---|
| 227 |
|
---|
[7fe0ce3b] | 228 | python3 (symlink);
|
---|
| 229 | python&python3-majorver; and python&python3-majorver;m (hardlinked);
|
---|
[355495ce] | 230 |
|
---|
[7fe0ce3b] | 231 | python3-config (symlink),
|
---|
| 232 | python&python3-majorver;-config (symlink),
|
---|
[c525bd1] | 233 | python&python3-majorver;m-config,
|
---|
[355495ce] | 234 |
|
---|
[7fe0ce3b] | 235 | pyvenv (symlink),
|
---|
[41d241e] | 236 | pyvenv-&python3-majorver;,
|
---|
[355495ce] | 237 | </seg>
|
---|
| 238 | <seg>
|
---|
[47f0aa1] | 239 | libpython&python3-majorver;m.so and libpython3.so
|
---|
[355495ce] | 240 | </seg>
|
---|
| 241 | <seg>
|
---|
[c525bd1] | 242 | /usr/include/python&python3-majorver;m,
|
---|
[355495ce] | 243 | /usr/lib/python&python3-majorver;, and
|
---|
| 244 | /usr/share/doc/python-&python3-version;
|
---|
| 245 | </seg>
|
---|
[83f69e5d] | 246 | </seglistitem>
|
---|
| 247 | </segmentedlist>
|
---|
| 248 |
|
---|
| 249 | <variablelist>
|
---|
| 250 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 251 | <?dbfo list-presentation="list"?>
|
---|
| 252 | <?dbhtml list-presentation="table"?>
|
---|
| 253 |
|
---|
[355495ce] | 254 | <varlistentry id="idle3">
|
---|
| 255 | <term><command>idle3</command></term>
|
---|
[83f69e5d] | 256 | <listitem>
|
---|
[355495ce] | 257 | <para>
|
---|
[d0aecd33] | 258 | is a wrapper script that opens a <application>Python</application>
|
---|
| 259 | aware GUI editor. For this script to run, you must have installed
|
---|
| 260 | <application>Tk</application> before Python so that the Tkinter
|
---|
| 261 | Python module is built.
|
---|
[355495ce] | 262 | </para>
|
---|
| 263 | <indexterm zone="python3 idle3">
|
---|
| 264 | <primary sortas="b-idle3">idle3</primary>
|
---|
[83f69e5d] | 265 | </indexterm>
|
---|
| 266 | </listitem>
|
---|
| 267 | </varlistentry>
|
---|
| 268 |
|
---|
[355495ce] | 269 | <varlistentry id="pydoc3">
|
---|
| 270 | <term><command>pydoc3</command></term>
|
---|
[83f69e5d] | 271 | <listitem>
|
---|
[355495ce] | 272 | <para>
|
---|
| 273 | is the <application>Python</application> documentation
|
---|
| 274 | tool.
|
---|
| 275 | </para>
|
---|
| 276 | <indexterm zone="python3 pydoc3">
|
---|
| 277 | <primary sortas="b-pydoc3">pydo3c</primary>
|
---|
[83f69e5d] | 278 | </indexterm>
|
---|
| 279 | </listitem>
|
---|
| 280 | </varlistentry>
|
---|
| 281 |
|
---|
[b88be39] | 282 | <varlistentry id="python3-prog">
|
---|
[2cee003] | 283 | <term><command>python3</command></term>
|
---|
[83f69e5d] | 284 | <listitem>
|
---|
[355495ce] | 285 | <para>
|
---|
| 286 | is an interpreted, interactive, object-oriented programming
|
---|
| 287 | language.
|
---|
| 288 | </para>
|
---|
[b88be39] | 289 | <indexterm zone="python3 python3-prog">
|
---|
| 290 | <primary sortas="b-python3">python3</primary>
|
---|
[83f69e5d] | 291 | </indexterm>
|
---|
| 292 | </listitem>
|
---|
| 293 | </varlistentry>
|
---|
| 294 |
|
---|
[f67f5387] | 295 | <varlistentry id="python-ver">
|
---|
[b88be39] | 296 | <term><command>python&python3-majorver;</command></term>
|
---|
[83f69e5d] | 297 | <listitem>
|
---|
[355495ce] | 298 | <para>
|
---|
| 299 | is a version-specific name for the <command>python</command>
|
---|
| 300 | program.
|
---|
| 301 | </para>
|
---|
[b88be39] | 302 | <indexterm zone="python3 python-ver">
|
---|
[2cee003] | 303 | <primary
|
---|
| 304 | sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
|
---|
[83f69e5d] | 305 | </indexterm>
|
---|
| 306 | </listitem>
|
---|
| 307 | </varlistentry>
|
---|
| 308 |
|
---|
[21e8edc] | 309 | <varlistentry id="pyvenv">
|
---|
| 310 | <term><command>pyvenv</command></term>
|
---|
| 311 | <listitem>
|
---|
| 312 | <para>
|
---|
| 313 | creates virtual <application>Python</application> environments in
|
---|
| 314 | one or more target directories.
|
---|
| 315 | </para>
|
---|
| 316 | <indexterm zone="python3 pyvenv">
|
---|
| 317 | <primary
|
---|
| 318 | sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
|
---|
| 319 | </indexterm>
|
---|
| 320 | </listitem>
|
---|
| 321 | </varlistentry>
|
---|
| 322 |
|
---|
[83f69e5d] | 323 | </variablelist>
|
---|
| 324 |
|
---|
| 325 | </sect2>
|
---|
[f45b1953] | 326 |
|
---|
| 327 | </sect1>
|
---|