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