[bf847d6d] | 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 |
|
---|
[181662f] | 7 | <!ENTITY python2-download-http
|
---|
[549e65f] | 8 | "https://www.python.org/ftp/python/&python2-version;/Python-&python2-version;.tar.xz">
|
---|
[27d9434] | 9 | <!ENTITY python2-download-ftp " ">
|
---|
[5cd7055] | 10 | <!ENTITY python2-md5sum "30157d85a2c0479c09ea2cbe61f2aaf5">
|
---|
[549e65f] | 11 | <!ENTITY python2-size "12 MB">
|
---|
[5cd7055] | 12 | <!ENTITY python2-buildsize "131 MB (add 15 MB for tests)">
|
---|
| 13 | <!ENTITY python2-time "0.7 SBU (Using parallelism=4; add 6.6 SBU for tests)">
|
---|
[82fac2c] | 14 |
|
---|
[181662f] | 15 | <!ENTITY python2htmldoc-download-http
|
---|
[c8b4decb] | 16 | "https://docs.python.org/ftp/python/doc/&python2-version;/python-&python2-version;-docs-html.tar.bz2">
|
---|
[bf847d6d] | 17 | ]>
|
---|
| 18 |
|
---|
[4716d52] | 19 | <sect1 id="python2" xreflabel="Python-&python2-version;">
|
---|
[bf847d6d] | 20 | <?dbhtml filename="python2.html" ?>
|
---|
| 21 |
|
---|
| 22 | <sect1info>
|
---|
[4949485e] | 23 | <othername>$LastChangedBy$</othername>
|
---|
| 24 | <date>$Date$</date>
|
---|
[bf847d6d] | 25 | </sect1info>
|
---|
| 26 |
|
---|
| 27 | <title>Python-&python2-version;</title>
|
---|
| 28 |
|
---|
[4716d52] | 29 | <indexterm zone="python2">
|
---|
[82fac2c] | 30 | <primary sortas="a-Python2">Python2</primary>
|
---|
[bf847d6d] | 31 | </indexterm>
|
---|
| 32 |
|
---|
| 33 | <sect2 role="package">
|
---|
| 34 | <title>Introduction to Python 2</title>
|
---|
| 35 |
|
---|
[181662f] | 36 | <para>
|
---|
| 37 | The <application>Python 2</application> package contains the
|
---|
[82fac2c] | 38 | <application>Python</application> development environment. It is useful
|
---|
[181662f] | 39 | for object-oriented programming, writing scripts, prototyping large
|
---|
| 40 | programs or developing entire applications. This version is for backward
|
---|
| 41 | compatibility with other dependent packages.
|
---|
| 42 | </para>
|
---|
[bf847d6d] | 43 |
|
---|
[4343801] | 44 | <note>
|
---|
| 45 | <para>
|
---|
| 46 | Python2 has been deprecated by the upstream developers.
|
---|
| 47 | Support for Python2 will be discontinued on January
|
---|
| 48 | 1st, 2020.
|
---|
| 49 | </para>
|
---|
| 50 |
|
---|
| 51 | <para>
|
---|
| 52 | BLFS is attempting to use Python3 as much as possible, but some
|
---|
| 53 | packages have not been updated to support Python3.
|
---|
| 54 | </para>
|
---|
| 55 | </note>
|
---|
| 56 |
|
---|
| 57 |
|
---|
[38489aa0] | 58 | &lfs84_checked;
|
---|
[bf847d6d] | 59 |
|
---|
| 60 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 61 | <itemizedlist spacing="compact">
|
---|
| 62 | <listitem>
|
---|
[181662f] | 63 | <para>
|
---|
| 64 | Download (HTTP): <ulink url="&python2-download-http;"/>
|
---|
| 65 | </para>
|
---|
[bf847d6d] | 66 | </listitem>
|
---|
| 67 | <listitem>
|
---|
[181662f] | 68 | <para>
|
---|
| 69 | Download (FTP): <ulink url="&python2-download-ftp;"/>
|
---|
| 70 | </para>
|
---|
[bf847d6d] | 71 | </listitem>
|
---|
| 72 | <listitem>
|
---|
[181662f] | 73 | <para>
|
---|
| 74 | Download MD5 sum: &python2-md5sum;
|
---|
| 75 | </para>
|
---|
[bf847d6d] | 76 | </listitem>
|
---|
| 77 | <listitem>
|
---|
[181662f] | 78 | <para>
|
---|
| 79 | Download size: &python2-size;
|
---|
| 80 | </para>
|
---|
[bf847d6d] | 81 | </listitem>
|
---|
| 82 | <listitem>
|
---|
[181662f] | 83 | <para>
|
---|
| 84 | Estimated disk space required: &python2-buildsize;
|
---|
| 85 | </para>
|
---|
[bf847d6d] | 86 | </listitem>
|
---|
| 87 | <listitem>
|
---|
[181662f] | 88 | <para>
|
---|
| 89 | Estimated build time: &python2-time;
|
---|
| 90 | </para>
|
---|
[bf847d6d] | 91 | </listitem>
|
---|
| 92 | </itemizedlist>
|
---|
| 93 |
|
---|
[54ae6b8] | 94 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
| 95 |
|
---|
[5d11f8f] | 96 | <itemizedlist spacing="compact">
|
---|
| 97 | <title>Optional HTML Documentation</title>
|
---|
[bf847d6d] | 98 | <listitem>
|
---|
[181662f] | 99 | <para>
|
---|
[5d11f8f] | 100 | Download (HTTP): <ulink url="&python2htmldoc-download-http;"/>
|
---|
[181662f] | 101 | </para>
|
---|
[bf847d6d] | 102 | </listitem>
|
---|
[fb990982] | 103 | </itemizedlist>
|
---|
| 104 |
|
---|
[03d30cf] | 105 | <bridgehead renderas="sect3">Python 2 Dependencies</bridgehead>
|
---|
[60ddbaf] | 106 | <!--
|
---|
[82fac2c] | 107 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
| 108 | <para role="recommended">
|
---|
[adf6dd9a] | 109 | <xref linkend="libffi"/>
|
---|
[82fac2c] | 110 | </para>
|
---|
[60ddbaf] | 111 | -->
|
---|
[bf847d6d] | 112 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[181662f] | 113 | <para role="optional">
|
---|
[9be7202] | 114 | <xref linkend="bluez"/> and
|
---|
| 115 | <xref linkend="valgrind"/>
|
---|
[82fac2c] | 116 | </para>
|
---|
| 117 |
|
---|
| 118 | <bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
|
---|
| 119 | <para role="optional">
|
---|
| 120 | <xref linkend="sqlite"/> and
|
---|
| 121 | <xref linkend="tk"/>
|
---|
[181662f] | 122 | </para>
|
---|
[94b42903] | 123 | <!--
|
---|
[5be3a74] | 124 | <note>
|
---|
| 125 | <para>
|
---|
[b9f61df] | 126 | If you are building <xref linkend="thunderbird"/> or
|
---|
[f3429309] | 127 | <xref linkend="firefox"/>
|
---|
[80454f5] | 128 | you must install <application>openssl</application> before you build
|
---|
[5be3a74] | 129 | <application>Python 2</application>.
|
---|
| 130 | </para>
|
---|
| 131 | </note>
|
---|
[94b42903] | 132 | -->
|
---|
[181662f] | 133 | <para condition="html" role="usernotes">
|
---|
| 134 | User Notes: <ulink url="&blfs-wiki;/Python"/>
|
---|
| 135 | </para>
|
---|
[bf847d6d] | 136 | </sect2>
|
---|
| 137 |
|
---|
| 138 | <sect2 role="installation">
|
---|
[03d30cf] | 139 | <title>Installation of Python 2</title>
|
---|
[bf847d6d] | 140 |
|
---|
[4343801] | 141 | <caution>
|
---|
| 142 | <para>
|
---|
| 143 | If updating <application>pip2</application> with the command
|
---|
| 144 | <command>pip2 install --upgrade pip</command>, it will remove
|
---|
| 145 | <application>pip3</application> and the symlink
|
---|
| 146 | <application>pip</application> installed in LFS. To restore
|
---|
| 147 | <application>pip</application> and <application>pip3</application>,
|
---|
| 148 | run, as the <systemitem class="username">root</systemitem> user:
|
---|
| 149 | </para>
|
---|
| 150 |
|
---|
| 151 | <screen role="nodump"><userinput>python3 -m pip install --force pip</userinput></screen>
|
---|
| 152 | </caution>
|
---|
| 153 |
|
---|
[181662f] | 154 | <para>
|
---|
[03d30cf] | 155 | Install <application>Python 2</application> by running the following
|
---|
[181662f] | 156 | commands:
|
---|
| 157 | </para>
|
---|
[bf847d6d] | 158 |
|
---|
[167a240] | 159 | <screen><userinput>./configure --prefix=/usr \
|
---|
[82fac2c] | 160 | --enable-shared \
|
---|
| 161 | --with-system-expat \
|
---|
| 162 | --with-system-ffi \
|
---|
[879932f] | 163 | --with-ensurepip=yes \
|
---|
[82fac2c] | 164 | --enable-unicode=ucs4 &&
|
---|
[bf847d6d] | 165 | make</userinput></screen>
|
---|
| 166 |
|
---|
[167a240] | 167 | <para>
|
---|
[1a64240] | 168 | To test the results, issue: <command>make -k test</command>.
|
---|
[b61e62f] | 169 | Three tests fail for unknown reasons.
|
---|
[181662f] | 170 | </para>
|
---|
[bf847d6d] | 171 |
|
---|
[181662f] | 172 | <para>
|
---|
| 173 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 174 | </para>
|
---|
[bf847d6d] | 175 |
|
---|
[7224506] | 176 | <screen role="root"><userinput>make install &&
|
---|
| 177 | chmod -v 755 /usr/lib/libpython&python2-majorver;.so.1.0</userinput></screen>
|
---|
[bf847d6d] | 178 |
|
---|
[181662f] | 179 | <para>
|
---|
[7fe0ce3b] | 180 | Since <application>Python 2</application> is in maintenance mode, and
|
---|
| 181 | <application>Python 3</application> is recommended by upstream for
|
---|
[8b9b43e] | 182 | development, you probably do not need to install the documentation.
|
---|
[7fe0ce3b] | 183 | However, if you still want to install documentation for both
|
---|
[8b9b43e] | 184 | <application>Python</application> versions, be sure to define the
|
---|
| 185 | <envar>PYTHONDOCS</envar>
|
---|
[7fe0ce3b] | 186 | variable for the version you want to use, each time you need to consult
|
---|
| 187 | the documentation. If you have downloaded the preformatted documentation
|
---|
| 188 | from <ulink url="http://docs.python.org/download.html"/>, install it
|
---|
[03d30cf] | 189 | as the <systemitem class="username">root</systemitem> user:
|
---|
[181662f] | 190 | </para>
|
---|
| 191 |
|
---|
[23d3543c] | 192 | <screen role="root"><userinput>install -v -dm755 /usr/share/doc/python-&python2-version; &&
|
---|
[7b273030] | 193 |
|
---|
| 194 | tar --strip-components=1 \
|
---|
| 195 | --no-same-owner \
|
---|
| 196 | --directory /usr/share/doc/python-&python2-version; \
|
---|
| 197 | -xvf ../python-&python2-version;-docs-html.tar.bz2 &&
|
---|
| 198 |
|
---|
[03d30cf] | 199 | find /usr/share/doc/python-&python2-version; -type d -exec chmod 0755 {} \; &&
|
---|
| 200 | find /usr/share/doc/python-&python2-version; -type f -exec chmod 0644 {} \;</userinput></screen>
|
---|
[bf847d6d] | 201 | </sect2>
|
---|
| 202 |
|
---|
| 203 | <sect2 role="commands">
|
---|
| 204 | <title>Command Explanations</title>
|
---|
| 205 |
|
---|
[82fac2c] | 206 | <para>
|
---|
[00ff1df] | 207 | <parameter>--with-system-expat</parameter>: This switch enables linking
|
---|
| 208 | against system version of <application>Expat</application>.
|
---|
[82fac2c] | 209 | </para>
|
---|
| 210 |
|
---|
| 211 | <para>
|
---|
[00ff1df] | 212 | <parameter>--with-system-ffi</parameter>: This switch enables linking
|
---|
[60ddbaf] | 213 | against system version of <application>libffi</application>.
|
---|
[82fac2c] | 214 | </para>
|
---|
| 215 |
|
---|
[23c5563] | 216 | <para>
|
---|
| 217 | <parameter>--with-ensurepip=yes</parameter> : This switch enables building
|
---|
| 218 | <command>pip</command> and <command>setuptools</command> packaging programs.
|
---|
| 219 | <command>setuptools</command> is needed for building some Python modules.
|
---|
| 220 | </para>
|
---|
| 221 |
|
---|
[82fac2c] | 222 | <para>
|
---|
| 223 | <parameter>--enable-unicode=ucs4</parameter>: This switch enables
|
---|
| 224 | 32bit Unicode support in <application>Python</application>.
|
---|
| 225 | </para>
|
---|
| 226 |
|
---|
| 227 | <para>
|
---|
[00ff1df] | 228 | <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
|
---|
[0d7900a] | 229 | if you want to build <application>Python</application> DBM Module
|
---|
[82fac2c] | 230 | against <application>Berkeley DB</application> instead of
|
---|
| 231 | <application>GDBM</application>.
|
---|
| 232 | </para>
|
---|
| 233 |
|
---|
[181662f] | 234 | <para>
|
---|
[0d7900a] | 235 | <command>chmod ...</command>: Fix permissions for libraries to be
|
---|
[181662f] | 236 | consistent with other libraries.
|
---|
| 237 | </para>
|
---|
[82fac2c] | 238 |
|
---|
[bf847d6d] | 239 | </sect2>
|
---|
| 240 |
|
---|
| 241 | <sect2 role="configuration">
|
---|
| 242 | <title>Configuring Python 2</title>
|
---|
| 243 |
|
---|
[181662f] | 244 | <para>
|
---|
| 245 | In order for <command>python</command> to find the installed
|
---|
| 246 | documentation, you must add the following environment variable to
|
---|
| 247 | individual user's or the system's profile:
|
---|
| 248 | </para>
|
---|
[bf847d6d] | 249 |
|
---|
[03d30cf] | 250 | <screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-&python2-version;</userinput></screen>
|
---|
[82fac2c] | 251 |
|
---|
[bf847d6d] | 252 | </sect2>
|
---|
| 253 |
|
---|
| 254 | <sect2 role="content">
|
---|
| 255 | <title>Contents</title>
|
---|
| 256 |
|
---|
| 257 | <segmentedlist>
|
---|
| 258 | <segtitle>Installed Programs</segtitle>
|
---|
[03d30cf] | 259 | <segtitle>Installed Library</segtitle>
|
---|
[bf847d6d] | 260 | <segtitle>Installed Directories</segtitle>
|
---|
| 261 |
|
---|
| 262 | <seglistitem>
|
---|
[181662f] | 263 | <seg>
|
---|
[4343801] | 264 | 2to3, pip2, pydoc, python (symlink), python-config (symlink),
|
---|
[167a240] | 265 | python2 (symlink), python2-config (symlink),
|
---|
[03d30cf] | 266 | python&python2-majorver;, python&python2-majorver;-config,
|
---|
[d0aecd33] | 267 | smtpd.py, and idle
|
---|
[181662f] | 268 | </seg>
|
---|
| 269 | <seg>
|
---|
[03d30cf] | 270 | libpython&python2-majorver;.so
|
---|
[181662f] | 271 | </seg>
|
---|
| 272 | <seg>
|
---|
[fcabde3c] | 273 | /usr/{include,lib}/python&python2-majorver; and
|
---|
| 274 | /usr/share/doc/python-&python2-version;
|
---|
| 275 | </seg>
|
---|
[bf847d6d] | 276 | </seglistitem>
|
---|
| 277 | </segmentedlist>
|
---|
| 278 |
|
---|
| 279 | <variablelist>
|
---|
| 280 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 281 | <?dbfo list-presentation="list"?>
|
---|
| 282 | <?dbhtml list-presentation="table"?>
|
---|
| 283 |
|
---|
[62f9a8e] | 284 | <varlistentry id="python2-2to3">
|
---|
| 285 | <term><command>2to3</command></term>
|
---|
| 286 | <listitem>
|
---|
| 287 | <para>
|
---|
| 288 | is a <application>Python</application> program that reads
|
---|
[00ff1df] | 289 | <application>Python 2.x</application> source code and applies a
|
---|
| 290 | series of fixes to transform it into valid
|
---|
| 291 | <application>Python 3.x</application> code.
|
---|
[62f9a8e] | 292 | </para>
|
---|
| 293 | <indexterm zone="python2 python2-2to3">
|
---|
| 294 | <primary sortas="b-2to3">2to3</primary>
|
---|
| 295 | </indexterm>
|
---|
| 296 | </listitem>
|
---|
| 297 | </varlistentry>
|
---|
| 298 |
|
---|
[4343801] | 299 | <varlistentry id="pip2">
|
---|
| 300 | <term><command>pip2</command></term>
|
---|
| 301 | <listitem>
|
---|
| 302 | <para>
|
---|
| 303 | is the package manager for <application>Python 2.x</application>.
|
---|
| 304 | It is used to automate management of
|
---|
| 305 | <application>Python 2.x</application> modules.
|
---|
| 306 | </para>
|
---|
| 307 | <indexterm zone="python2 pip2">
|
---|
| 308 | <primary sortas="b-pip2">pip2</primary>
|
---|
| 309 | </indexterm>
|
---|
| 310 | </listitem>
|
---|
| 311 | </varlistentry>
|
---|
| 312 |
|
---|
[03d30cf] | 313 | <varlistentry id="idle">
|
---|
[bf847d6d] | 314 | <term><command>idle</command></term>
|
---|
| 315 | <listitem>
|
---|
[181662f] | 316 | <para>
|
---|
| 317 | is a wrapper script that opens a <application>Python</application>
|
---|
[d0aecd33] | 318 | aware GUI editor. For this script to run, you must have installed
|
---|
| 319 | <application>Tk</application> before Python so that the Tkinter
|
---|
| 320 | Python module is built.
|
---|
[181662f] | 321 | </para>
|
---|
[03d30cf] | 322 | <indexterm zone="python2 idle">
|
---|
| 323 | <primary sortas="b-idle">idle</primary>
|
---|
[bf847d6d] | 324 | </indexterm>
|
---|
| 325 | </listitem>
|
---|
| 326 | </varlistentry>
|
---|
| 327 |
|
---|
| 328 | <varlistentry id="pydoc2">
|
---|
| 329 | <term><command>pydoc</command></term>
|
---|
| 330 | <listitem>
|
---|
[181662f] | 331 | <para>
|
---|
| 332 | is the <application>Python</application> documentation tool.
|
---|
| 333 | </para>
|
---|
[4716d52] | 334 | <indexterm zone="python2 pydoc2">
|
---|
[bf847d6d] | 335 | <primary sortas="b-pydoc2">pydoc</primary>
|
---|
| 336 | </indexterm>
|
---|
| 337 | </listitem>
|
---|
| 338 | </varlistentry>
|
---|
| 339 |
|
---|
[181662f] | 340 | <varlistentry id="python">
|
---|
[bf847d6d] | 341 | <term><command>python</command></term>
|
---|
| 342 | <listitem>
|
---|
[181662f] | 343 | <para>
|
---|
| 344 | is an interpreted, interactive, object-oriented programming
|
---|
| 345 | language.
|
---|
| 346 | </para>
|
---|
| 347 | <indexterm zone="python2 python">
|
---|
[4716d52] | 348 | <primary sortas="b-python2">python</primary>
|
---|
[bf847d6d] | 349 | </indexterm>
|
---|
| 350 | </listitem>
|
---|
| 351 | </varlistentry>
|
---|
| 352 |
|
---|
| 353 | <varlistentry id="python2-ver">
|
---|
| 354 | <term><command>python&python2-majorver;</command></term>
|
---|
| 355 | <listitem>
|
---|
[181662f] | 356 | <para>
|
---|
| 357 | is a version-specific name for the <command>python</command>
|
---|
| 358 | program.
|
---|
| 359 | </para>
|
---|
[4716d52] | 360 | <indexterm zone="python2 python2-ver">
|
---|
[b88be39] | 361 | <primary sortas="b-python&python2-majorver;">python&python2-majorver;</primary>
|
---|
[bf847d6d] | 362 | </indexterm>
|
---|
| 363 | </listitem>
|
---|
| 364 | </varlistentry>
|
---|
| 365 |
|
---|
[03d30cf] | 366 | <varlistentry id="smtpd.py">
|
---|
[bf847d6d] | 367 | <term><command>smtpd.py</command></term>
|
---|
| 368 | <listitem>
|
---|
[181662f] | 369 | <para>
|
---|
| 370 | is an SMTP proxy implemented in <application>Python</application>.
|
---|
| 371 | </para>
|
---|
[03d30cf] | 372 | <indexterm zone="python2 smtpd.py">
|
---|
| 373 | <primary sortas="b-smtpd.py">smtpd.py</primary>
|
---|
[bf847d6d] | 374 | </indexterm>
|
---|
| 375 | </listitem>
|
---|
| 376 | </varlistentry>
|
---|
[82fac2c] | 377 |
|
---|
[bf847d6d] | 378 | </variablelist>
|
---|
[82fac2c] | 379 |
|
---|
[bf847d6d] | 380 | </sect2>
|
---|
[82fac2c] | 381 |
|
---|
[bf847d6d] | 382 | </sect1>
|
---|