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