[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 " ">
|
---|
[e51029f] | 10 | <!ENTITY python3-md5sum "b8094f007b3a835ca3be6bdf8116cccc">
|
---|
[3df4c93] | 11 | <!ENTITY python3-size "19 MB">
|
---|
[e51029f] | 12 | <!ENTITY python3-buildsize "202 MB (add 23 MB for tests)">
|
---|
| 13 | <!ENTITY python3-time "2.3 SBU (add 1.6 SBU for tests; both using parallelism=4)">
|
---|
[e882fc37] | 14 | <!--
|
---|
[73353e7f] | 15 | Note: Size does not reflect docs that were install in LFS.
|
---|
[3df4c93] | 16 | -->
|
---|
[2cee003] | 17 | <!ENTITY python3htmldoc-download-http
|
---|
[1fe05eb] | 18 | "https://www.python.org/ftp/python/doc/&python3-version;/python-&python3-version;-docs-html.tar.bz2">
|
---|
[335b32d] | 19 | <!ENTITY python3-docs-md5sum "d5923c417995334e72c2561812905d23" >
|
---|
[52d29f7] | 20 | ]>
|
---|
| 21 |
|
---|
[b88be39] | 22 | <sect1 id="python3" xreflabel="Python-&python3-version;">
|
---|
| 23 | <?dbhtml filename="python3.html" ?>
|
---|
[83f69e5d] | 24 |
|
---|
| 25 | <sect1info>
|
---|
| 26 | <date>$Date$</date>
|
---|
| 27 | </sect1info>
|
---|
| 28 |
|
---|
[b88be39] | 29 | <title>Python-&python3-version;</title>
|
---|
[83f69e5d] | 30 |
|
---|
[b88be39] | 31 | <indexterm zone="python3">
|
---|
[03d30cf] | 32 | <primary sortas="a-Python3">Python3</primary>
|
---|
[83f69e5d] | 33 | </indexterm>
|
---|
| 34 |
|
---|
| 35 | <sect2 role="package">
|
---|
[03d30cf] | 36 | <title>Introduction to Python 3</title>
|
---|
[83f69e5d] | 37 |
|
---|
[355495ce] | 38 | <para>
|
---|
[03d30cf] | 39 | The <application>Python 3</application> package contains the
|
---|
[355495ce] | 40 | <application>Python</application> development environment.
|
---|
| 41 | This is useful for object-oriented programming, writing scripts,
|
---|
| 42 | prototyping large programs or developing entire applications.
|
---|
| 43 | </para>
|
---|
[48b816cb] | 44 |
|
---|
[de33b2a] | 45 | <note>
|
---|
| 46 | <para>
|
---|
| 47 | <application>Python 3</application> was installed in LFS.
|
---|
| 48 | The only reason to rebuild it here is if optional modules
|
---|
[b9a6bcc0] | 49 | are needed, or to upgrade this package.
|
---|
[de33b2a] | 50 | </para>
|
---|
| 51 | </note>
|
---|
[60ddbaf] | 52 |
|
---|
[ce1dd9df] | 53 | &lfs112_checked;
|
---|
[48b816cb] | 54 |
|
---|
[83f69e5d] | 55 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 56 | <itemizedlist spacing="compact">
|
---|
| 57 | <listitem>
|
---|
[355495ce] | 58 | <para>
|
---|
| 59 | Download (HTTP): <ulink url="&python3-download-http;"/>
|
---|
| 60 | </para>
|
---|
[83f69e5d] | 61 | </listitem>
|
---|
| 62 | <listitem>
|
---|
[355495ce] | 63 | <para>
|
---|
| 64 | Download (FTP): <ulink url="&python3-download-ftp;"/>
|
---|
| 65 | </para>
|
---|
[83f69e5d] | 66 | </listitem>
|
---|
| 67 | <listitem>
|
---|
[355495ce] | 68 | <para>
|
---|
| 69 | Download MD5 sum: &python3-md5sum;
|
---|
| 70 | </para>
|
---|
[83f69e5d] | 71 | </listitem>
|
---|
| 72 | <listitem>
|
---|
[355495ce] | 73 | <para>
|
---|
| 74 | Download size: &python3-size;
|
---|
| 75 | </para>
|
---|
[83f69e5d] | 76 | </listitem>
|
---|
| 77 | <listitem>
|
---|
[355495ce] | 78 | <para>
|
---|
| 79 | Estimated disk space required: &python3-buildsize;
|
---|
| 80 | </para>
|
---|
[83f69e5d] | 81 | </listitem>
|
---|
| 82 | <listitem>
|
---|
[355495ce] | 83 | <para>
|
---|
| 84 | Estimated build time: &python3-time;
|
---|
| 85 | </para>
|
---|
[83f69e5d] | 86 | </listitem>
|
---|
| 87 | </itemizedlist>
|
---|
[e882fc37] | 88 |
|
---|
[3df4c93] | 89 | <bridgehead renderas="sect3">Additional Optional Download</bridgehead>
|
---|
| 90 | <itemizedlist spacing="compact">
|
---|
| 91 | <listitem>
|
---|
| 92 | <para>
|
---|
| 93 | Download (HTTP): <ulink url="&python3htmldoc-download-http;"/>
|
---|
| 94 | </para>
|
---|
| 95 | </listitem>
|
---|
| 96 | <listitem>
|
---|
| 97 | <para>
|
---|
| 98 | Download MD5 sum: &python3-docs-md5sum;
|
---|
| 99 | </para>
|
---|
| 100 | </listitem>
|
---|
| 101 | </itemizedlist>
|
---|
| 102 |
|
---|
[03d30cf] | 103 | <bridgehead renderas="sect3">Python 3 Dependencies</bridgehead>
|
---|
[e882fc37] | 104 |
|
---|
[693f28e1] | 105 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
| 106 | <para role="recommended">
|
---|
[a82b5f44] | 107 | <xref linkend="sqlite"/> (required if building firefox or thunderbird)
|
---|
[693f28e1] | 108 | </para>
|
---|
| 109 |
|
---|
[83f69e5d] | 110 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[355495ce] | 111 | <para role="optional">
|
---|
[7fe0ce3b] | 112 | <xref linkend="bluez"/>,
|
---|
[e882fc37] | 113 | <xref linkend="gdb"/> (required for some tests),
|
---|
| 114 | <xref linkend="valgrind"/>, and
|
---|
[4e207bb] | 115 | <ulink url="https://www.bytereef.org/mpdecimal/">libmpdec</ulink>
|
---|
[355495ce] | 116 | </para>
|
---|
| 117 |
|
---|
| 118 | <bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
|
---|
| 119 | <para role="optional">
|
---|
[9464475] | 120 | <xref linkend="db"/>,
|
---|
| 121 | <xref linkend="libnsl"/>, and
|
---|
[6030130] | 122 | <xref linkend="tk"/>
|
---|
[355495ce] | 123 | </para>
|
---|
[ce33273] | 124 |
|
---|
[1039de3] | 125 | <para condition="html" role="usernotes">User Notes:
|
---|
[355495ce] | 126 | <ulink url="&blfs-wiki;/Python3"/>
|
---|
| 127 | </para>
|
---|
[83f69e5d] | 128 | </sect2>
|
---|
| 129 |
|
---|
| 130 | <sect2 role="installation">
|
---|
[03d30cf] | 131 | <title>Installation of Python 3</title>
|
---|
[83f69e5d] | 132 |
|
---|
[355495ce] | 133 | <para>
|
---|
[03d30cf] | 134 | Install <application>Python 3</application> by running the following
|
---|
[355495ce] | 135 | commands:
|
---|
| 136 | </para>
|
---|
[83f69e5d] | 137 |
|
---|
[a87fb41] | 138 | <screen><userinput>CXX="/usr/bin/g++" \
|
---|
| 139 | ./configure --prefix=/usr \
|
---|
| 140 | --enable-shared \
|
---|
| 141 | --with-system-expat \
|
---|
| 142 | --with-system-ffi \
|
---|
| 143 | --enable-optimizations &&
|
---|
[83f69e5d] | 144 | make</userinput></screen>
|
---|
| 145 |
|
---|
[355495ce] | 146 | <para>
|
---|
[8bed3aa1] | 147 | To test the result, issue <command>make test</command>.
|
---|
[e51029f] | 148 | Some tests may need an Internet connection. Two tests, test_distutils
|
---|
| 149 | and test_peg_generator are known to fail.
|
---|
[355495ce] | 150 | </para>
|
---|
| 151 |
|
---|
| 152 | <para>
|
---|
| 153 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 154 | </para>
|
---|
| 155 |
|
---|
[3df4c93] | 156 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
| 157 |
|
---|
| 158 | <para>
|
---|
[1fe05eb] | 159 | If upgrading and the documentation has been downloaded, optionally install
|
---|
[3df4c93] | 160 | it as the &root; user:
|
---|
| 161 | </para>
|
---|
| 162 |
|
---|
| 163 | <screen role="root"><userinput>tar --strip-components=1 \
|
---|
| 164 | --no-same-owner \
|
---|
| 165 | --no-same-permissions \
|
---|
| 166 | -C /usr/share/doc/python-&python3-version;/html \
|
---|
| 167 | -xvf ../python-&python3-version;-docs-html.tar.bz2</userinput></screen>
|
---|
[1970f00] | 168 |
|
---|
[879d269] | 169 | </sect2>
|
---|
| 170 |
|
---|
| 171 | <sect2 role="commands">
|
---|
| 172 | <title>Command Explanations</title>
|
---|
| 173 |
|
---|
[fd69a62] | 174 | <para>
|
---|
| 175 | <command> CXX="/usr/bin/g++" ./configure ...</command>: Avoid an annoying
|
---|
| 176 | message during configuration.
|
---|
| 177 | </para>
|
---|
| 178 |
|
---|
[355495ce] | 179 | <para>
|
---|
[f1d7196] | 180 | <parameter>--with-system-expat</parameter>: This switch enables linking
|
---|
| 181 | against the system version of <application>Expat</application>.
|
---|
[355495ce] | 182 | </para>
|
---|
| 183 |
|
---|
| 184 | <para>
|
---|
[f1d7196] | 185 | <parameter>--with-system-ffi</parameter>: This switch enables linking
|
---|
[8558044] | 186 | against the system version of <application>libffi</application>.
|
---|
[82fac2c] | 187 | </para>
|
---|
[988edbf5] | 188 | <!--
|
---|
[fd69a62] | 189 | <para>
|
---|
[6e94284] | 190 | <parameter>- -with-ensurepip=yes</parameter> : This switch enables building
|
---|
[8558044] | 191 | the <command>pip</command> and <command>setuptools</command> packaging
|
---|
[229d0692] | 192 | programs. <command>setuptools</command> is needed for building some
|
---|
| 193 | Python modules.
|
---|
[fd69a62] | 194 | </para>
|
---|
[988edbf5] | 195 | -->
|
---|
[f1d7196] | 196 | <para>
|
---|
| 197 | <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
|
---|
[229d0692] | 198 | if you want to build the <application>Python</application> DBM Module
|
---|
[f1d7196] | 199 | against <application>Berkeley DB</application> instead of
|
---|
| 200 | <application>GDBM</application>.
|
---|
| 201 | </para>
|
---|
| 202 |
|
---|
[7c57f82] | 203 | <para>
|
---|
[a0bb9145] | 204 | <parameter>--enable-optimizations</parameter>: This switch enables
|
---|
[a87fb41] | 205 | stable, but expensive, optimizations.
|
---|
[7c57f82] | 206 | </para>
|
---|
| 207 |
|
---|
| 208 | <para>
|
---|
| 209 | <option>--with-lto</option>: This optional switch enables thick Link
|
---|
| 210 | Time Optimization. Unusually, it creates a much larger <filename
|
---|
[4e207bb] | 211 | class="libraryfile">/usr/lib/python&python3-majorver;/config-&python3-majorver;-<arch>-linux-gnu/libpython&python3-majorver;.a</filename>
|
---|
[7c57f82] | 212 | with a small increase in the time to compile
|
---|
| 213 | <application>Python</application>. Run-time results do not appear to show
|
---|
| 214 | any benefit from doing this.
|
---|
| 215 | </para>
|
---|
[7224506] | 216 |
|
---|
[879d269] | 217 | </sect2>
|
---|
| 218 |
|
---|
| 219 | <sect2 role="configuration">
|
---|
[03d30cf] | 220 | <title>Configuring Python 3</title>
|
---|
[879d269] | 221 |
|
---|
[355495ce] | 222 | <para>
|
---|
[03d30cf] | 223 | In order for <command>python3</command> to find the installed
|
---|
[d7015e7] | 224 | documentation, create the following version independent symlink:
|
---|
[355495ce] | 225 | </para>
|
---|
[1970f00] | 226 |
|
---|
[d7015e7] | 227 | <screen role="root"><userinput>ln -svfn python-&python3-version; /usr/share/doc/python-3</userinput></screen>
|
---|
| 228 |
|
---|
| 229 | <para>
|
---|
| 230 | and add the following environment variable to the individual user's or
|
---|
| 231 | system's profile:
|
---|
| 232 | </para>
|
---|
| 233 |
|
---|
| 234 | <screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-3/html</userinput></screen>
|
---|
[83f69e5d] | 235 |
|
---|
| 236 | </sect2>
|
---|
| 237 |
|
---|
| 238 | <sect2 role="content">
|
---|
| 239 | <title>Contents</title>
|
---|
| 240 |
|
---|
| 241 | <segmentedlist>
|
---|
| 242 | <segtitle>Installed Programs</segtitle>
|
---|
| 243 | <segtitle>Installed Libraries</segtitle>
|
---|
| 244 | <segtitle>Installed Directories</segtitle>
|
---|
| 245 |
|
---|
| 246 | <seglistitem>
|
---|
[355495ce] | 247 | <seg>
|
---|
[f2ff0e4] | 248 | 2to3 (symlink) and
|
---|
[355495ce] | 249 | 2to3-&python3-majorver;,
|
---|
| 250 |
|
---|
[229d0692] | 251 | <!--
|
---|
[f2ff0e4] | 252 | easy_install-&python3-majorver;,
|
---|
[229d0692] | 253 | -->
|
---|
[f2ff0e4] | 254 |
|
---|
| 255 | idle3 (symlink) and
|
---|
| 256 | idle&python3-majorver;,
|
---|
[f5c5306] | 257 |
|
---|
[f2ff0e4] | 258 | pip3 (symlink) and
|
---|
| 259 | pip&python3-majorver;,
|
---|
| 260 |
|
---|
[4873baa] | 261 | pydoc3 and
|
---|
[355495ce] | 262 | pydoc&python3-majorver;,
|
---|
| 263 |
|
---|
[7fe0ce3b] | 264 | python3 (symlink);
|
---|
[f2ff0e4] | 265 | python&python3-majorver;, and
|
---|
[355495ce] | 266 |
|
---|
[f2ff0e4] | 267 | python3-config (symlink) and
|
---|
| 268 | python&python3-majorver;-config
|
---|
[355495ce] | 269 | </seg>
|
---|
| 270 | <seg>
|
---|
[9e91b25] | 271 | libpython&python3-majorver;.so and libpython3.so
|
---|
[355495ce] | 272 | </seg>
|
---|
| 273 | <seg>
|
---|
[9e91b25] | 274 | /usr/include/python&python3-majorver;,
|
---|
[355495ce] | 275 | /usr/lib/python&python3-majorver;, and
|
---|
| 276 | /usr/share/doc/python-&python3-version;
|
---|
| 277 | </seg>
|
---|
[83f69e5d] | 278 | </seglistitem>
|
---|
| 279 | </segmentedlist>
|
---|
| 280 |
|
---|
| 281 | <variablelist>
|
---|
| 282 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 283 | <?dbfo list-presentation="list"?>
|
---|
| 284 | <?dbhtml list-presentation="table"?>
|
---|
[f2ff0e4] | 285 | <!--
|
---|
| 286 | <varlistentry id="2to3">
|
---|
| 287 | <term><command>2to3</command></term>
|
---|
| 288 | <listitem>
|
---|
| 289 | <para>
|
---|
| 290 | is designed to assist in the transition between python2 and python3
|
---|
| 291 | by automatically converting code to be Python3 compatible.
|
---|
| 292 | </para>
|
---|
| 293 | <indexterm zone="python3 2to3">
|
---|
| 294 | <primary sortas="b-2to3">2to3</primary>
|
---|
| 295 | </indexterm>
|
---|
| 296 | </listitem>
|
---|
| 297 | </varlistentry>
|
---|
| 298 | Put here for easy use when removing Python2 -->
|
---|
[229d0692] | 299 | <!--
|
---|
[f2ff0e4] | 300 | <varlistentry id="easy_install">
|
---|
| 301 | <term><command>easy_install</command></term>
|
---|
| 302 | <listitem>
|
---|
| 303 | <para>
|
---|
| 304 | is a frontend to pip3 to make it easier to configure python modules
|
---|
[4c24eb0a] | 305 | through the PIP package manager
|
---|
[f2ff0e4] | 306 | </para>
|
---|
| 307 | <indexterm zone="python3 easy_install">
|
---|
| 308 | <primary sortas="python3 easy_install">easy_install</primary>
|
---|
| 309 | </indexterm>
|
---|
| 310 | </listitem>
|
---|
| 311 | </varlistentry>
|
---|
[229d0692] | 312 | -->
|
---|
[355495ce] | 313 | <varlistentry id="idle3">
|
---|
| 314 | <term><command>idle3</command></term>
|
---|
[83f69e5d] | 315 | <listitem>
|
---|
[355495ce] | 316 | <para>
|
---|
[d0aecd33] | 317 | is a wrapper script that opens a <application>Python</application>
|
---|
| 318 | aware GUI editor. For this script to run, you must have installed
|
---|
| 319 | <application>Tk</application> before Python so that the Tkinter
|
---|
[4c24eb0a] | 320 | Python module is built
|
---|
[355495ce] | 321 | </para>
|
---|
| 322 | <indexterm zone="python3 idle3">
|
---|
| 323 | <primary sortas="b-idle3">idle3</primary>
|
---|
[83f69e5d] | 324 | </indexterm>
|
---|
| 325 | </listitem>
|
---|
| 326 | </varlistentry>
|
---|
| 327 |
|
---|
[355495ce] | 328 | <varlistentry id="pydoc3">
|
---|
| 329 | <term><command>pydoc3</command></term>
|
---|
[83f69e5d] | 330 | <listitem>
|
---|
[355495ce] | 331 | <para>
|
---|
| 332 | is the <application>Python</application> documentation
|
---|
[4c24eb0a] | 333 | tool
|
---|
[355495ce] | 334 | </para>
|
---|
| 335 | <indexterm zone="python3 pydoc3">
|
---|
| 336 | <primary sortas="b-pydoc3">pydo3c</primary>
|
---|
[83f69e5d] | 337 | </indexterm>
|
---|
| 338 | </listitem>
|
---|
| 339 | </varlistentry>
|
---|
| 340 |
|
---|
[b88be39] | 341 | <varlistentry id="python3-prog">
|
---|
[2cee003] | 342 | <term><command>python3</command></term>
|
---|
[83f69e5d] | 343 | <listitem>
|
---|
[355495ce] | 344 | <para>
|
---|
| 345 | is an interpreted, interactive, object-oriented programming
|
---|
[4c24eb0a] | 346 | language
|
---|
[355495ce] | 347 | </para>
|
---|
[b88be39] | 348 | <indexterm zone="python3 python3-prog">
|
---|
| 349 | <primary sortas="b-python3">python3</primary>
|
---|
[83f69e5d] | 350 | </indexterm>
|
---|
| 351 | </listitem>
|
---|
| 352 | </varlistentry>
|
---|
| 353 |
|
---|
[f67f5387] | 354 | <varlistentry id="python-ver">
|
---|
[b88be39] | 355 | <term><command>python&python3-majorver;</command></term>
|
---|
[83f69e5d] | 356 | <listitem>
|
---|
[355495ce] | 357 | <para>
|
---|
| 358 | is a version-specific name for the <command>python</command>
|
---|
[4c24eb0a] | 359 | program
|
---|
[355495ce] | 360 | </para>
|
---|
[b88be39] | 361 | <indexterm zone="python3 python-ver">
|
---|
[4c24eb0a] | 362 | <primary sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
|
---|
[83f69e5d] | 363 | </indexterm>
|
---|
| 364 | </listitem>
|
---|
| 365 | </varlistentry>
|
---|
[f2ff0e4] | 366 | <!--
|
---|
[21e8edc] | 367 | <varlistentry id="pyvenv">
|
---|
| 368 | <term><command>pyvenv</command></term>
|
---|
| 369 | <listitem>
|
---|
| 370 | <para>
|
---|
| 371 | creates virtual <application>Python</application> environments in
|
---|
| 372 | one or more target directories.
|
---|
| 373 | </para>
|
---|
| 374 | <indexterm zone="python3 pyvenv">
|
---|
| 375 | <primary
|
---|
| 376 | sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
|
---|
| 377 | </indexterm>
|
---|
| 378 | </listitem>
|
---|
| 379 | </varlistentry>
|
---|
[f2ff0e4] | 380 | -->
|
---|
[83f69e5d] | 381 | </variablelist>
|
---|
| 382 |
|
---|
| 383 | </sect2>
|
---|
[f45b1953] | 384 |
|
---|
| 385 | </sect1>
|
---|