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