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