[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 | <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 |
|
---|
[bfbc72a] | 56 | &lfs101_checked;
|
---|
[bf847d6d] | 57 |
|
---|
| 58 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 59 | <itemizedlist spacing="compact">
|
---|
| 60 | <listitem>
|
---|
[181662f] | 61 | <para>
|
---|
| 62 | Download (HTTP): <ulink url="&python2-download-http;"/>
|
---|
| 63 | </para>
|
---|
[bf847d6d] | 64 | </listitem>
|
---|
| 65 | <listitem>
|
---|
[181662f] | 66 | <para>
|
---|
| 67 | Download (FTP): <ulink url="&python2-download-ftp;"/>
|
---|
| 68 | </para>
|
---|
[bf847d6d] | 69 | </listitem>
|
---|
| 70 | <listitem>
|
---|
[181662f] | 71 | <para>
|
---|
| 72 | Download MD5 sum: &python2-md5sum;
|
---|
| 73 | </para>
|
---|
[bf847d6d] | 74 | </listitem>
|
---|
| 75 | <listitem>
|
---|
[181662f] | 76 | <para>
|
---|
| 77 | Download size: &python2-size;
|
---|
| 78 | </para>
|
---|
[bf847d6d] | 79 | </listitem>
|
---|
| 80 | <listitem>
|
---|
[181662f] | 81 | <para>
|
---|
| 82 | Estimated disk space required: &python2-buildsize;
|
---|
| 83 | </para>
|
---|
[bf847d6d] | 84 | </listitem>
|
---|
| 85 | <listitem>
|
---|
[181662f] | 86 | <para>
|
---|
| 87 | Estimated build time: &python2-time;
|
---|
| 88 | </para>
|
---|
[bf847d6d] | 89 | </listitem>
|
---|
| 90 | </itemizedlist>
|
---|
| 91 |
|
---|
[54ae6b8] | 92 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
| 93 |
|
---|
[5d11f8f] | 94 | <itemizedlist spacing="compact">
|
---|
[bf847d6d] | 95 | <listitem>
|
---|
[181662f] | 96 | <para>
|
---|
[292ff45] | 97 | Required patch:
|
---|
| 98 | <ulink url="&patch-root;/Python-&python2-version;-security_fixes-1.patch"/>
|
---|
| 99 | </para>
|
---|
| 100 | </listitem>
|
---|
| 101 | <listitem>
|
---|
| 102 | <para>
|
---|
| 103 | Optional HTML Documentation: <ulink url="&python2htmldoc-download-http;"/>
|
---|
[181662f] | 104 | </para>
|
---|
[bf847d6d] | 105 | </listitem>
|
---|
[fb990982] | 106 | </itemizedlist>
|
---|
| 107 |
|
---|
[292ff45] | 108 |
|
---|
[03d30cf] | 109 | <bridgehead renderas="sect3">Python 2 Dependencies</bridgehead>
|
---|
[60ddbaf] | 110 | <!--
|
---|
[82fac2c] | 111 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
| 112 | <para role="recommended">
|
---|
[adf6dd9a] | 113 | <xref linkend="libffi"/>
|
---|
[82fac2c] | 114 | </para>
|
---|
[60ddbaf] | 115 | -->
|
---|
[bf847d6d] | 116 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[181662f] | 117 | <para role="optional">
|
---|
[9be7202] | 118 | <xref linkend="bluez"/> and
|
---|
| 119 | <xref linkend="valgrind"/>
|
---|
[82fac2c] | 120 | </para>
|
---|
| 121 |
|
---|
| 122 | <bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
|
---|
| 123 | <para role="optional">
|
---|
| 124 | <xref linkend="sqlite"/> and
|
---|
| 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 |
|
---|
[292ff45] | 161 | <screen><userinput>
|
---|
| 162 | patch -Np1 -i ../Python-&python2-version;-security_fixes-1.patch &&
|
---|
| 163 | ./configure --prefix=/usr \
|
---|
| 164 | --enable-shared \
|
---|
| 165 | --with-system-expat \
|
---|
| 166 | --with-system-ffi \
|
---|
| 167 | --enable-unicode=ucs4 &&
|
---|
[bf847d6d] | 168 | make</userinput></screen>
|
---|
| 169 |
|
---|
[167a240] | 170 | <para>
|
---|
[292ff45] | 171 | If you invoke the tests, they will run through twice.
|
---|
[1a64240] | 172 | To test the results, issue: <command>make -k test</command>.
|
---|
[181662f] | 173 | </para>
|
---|
[bf847d6d] | 174 |
|
---|
[181662f] | 175 | <para>
|
---|
| 176 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 177 | </para>
|
---|
[bf847d6d] | 178 |
|
---|
[61f684f2] | 179 | <screen role="root"><userinput>make altinstall &&
|
---|
| 180 | ln -s python2.7 /usr/bin/python2 &&
|
---|
| 181 | ln -s python2.7-config /usr/bin/python2-config &&
|
---|
[7224506] | 182 | chmod -v 755 /usr/lib/libpython&python2-majorver;.so.1.0</userinput></screen>
|
---|
[bf847d6d] | 183 |
|
---|
[181662f] | 184 | <para>
|
---|
[7fe0ce3b] | 185 | Since <application>Python 2</application> is in maintenance mode, and
|
---|
| 186 | <application>Python 3</application> is recommended by upstream for
|
---|
[8b9b43e] | 187 | development, you probably do not need to install the documentation.
|
---|
[7fe0ce3b] | 188 | However, if you still want to install documentation for both
|
---|
[8b9b43e] | 189 | <application>Python</application> versions, be sure to define the
|
---|
| 190 | <envar>PYTHONDOCS</envar>
|
---|
[7fe0ce3b] | 191 | variable for the version you want to use, each time you need to consult
|
---|
| 192 | the documentation. If you have downloaded the preformatted documentation
|
---|
| 193 | from <ulink url="http://docs.python.org/download.html"/>, install it
|
---|
[03d30cf] | 194 | as the <systemitem class="username">root</systemitem> user:
|
---|
[181662f] | 195 | </para>
|
---|
| 196 |
|
---|
[23d3543c] | 197 | <screen role="root"><userinput>install -v -dm755 /usr/share/doc/python-&python2-version; &&
|
---|
[7b273030] | 198 |
|
---|
| 199 | tar --strip-components=1 \
|
---|
| 200 | --no-same-owner \
|
---|
| 201 | --directory /usr/share/doc/python-&python2-version; \
|
---|
| 202 | -xvf ../python-&python2-version;-docs-html.tar.bz2 &&
|
---|
| 203 |
|
---|
[03d30cf] | 204 | find /usr/share/doc/python-&python2-version; -type d -exec chmod 0755 {} \; &&
|
---|
| 205 | find /usr/share/doc/python-&python2-version; -type f -exec chmod 0644 {} \;</userinput></screen>
|
---|
[bf847d6d] | 206 | </sect2>
|
---|
| 207 |
|
---|
| 208 | <sect2 role="commands">
|
---|
| 209 | <title>Command Explanations</title>
|
---|
| 210 |
|
---|
[82fac2c] | 211 | <para>
|
---|
[00ff1df] | 212 | <parameter>--with-system-expat</parameter>: This switch enables linking
|
---|
| 213 | against system version of <application>Expat</application>.
|
---|
[82fac2c] | 214 | </para>
|
---|
| 215 |
|
---|
| 216 | <para>
|
---|
[00ff1df] | 217 | <parameter>--with-system-ffi</parameter>: This switch enables linking
|
---|
[60ddbaf] | 218 | against system version of <application>libffi</application>.
|
---|
[82fac2c] | 219 | </para>
|
---|
| 220 |
|
---|
[23c5563] | 221 | <para>
|
---|
[9c76376] | 222 | <parameter>--enable-unicode=ucs4</parameter>: This switch enables
|
---|
| 223 | 32bit Unicode support in <application>Python</application>.
|
---|
[23c5563] | 224 | </para>
|
---|
| 225 |
|
---|
[82fac2c] | 226 | <para>
|
---|
[9c76376] | 227 | <option>--with-ensurepip=yes</option> : This switch enables building
|
---|
| 228 | <command>pip</command> and <command>setuptools</command> packaging programs.
|
---|
| 229 | <command>setuptools</command> is needed for building some Python modules.
|
---|
| 230 | This switch is not recommended because this version of Python is being phased out.
|
---|
[82fac2c] | 231 | </para>
|
---|
| 232 |
|
---|
| 233 | <para>
|
---|
[00ff1df] | 234 | <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
|
---|
[0d7900a] | 235 | if you want to build <application>Python</application> DBM Module
|
---|
[82fac2c] | 236 | against <application>Berkeley DB</application> instead of
|
---|
| 237 | <application>GDBM</application>.
|
---|
| 238 | </para>
|
---|
| 239 |
|
---|
[61f684f2] | 240 | <para>
|
---|
| 241 | <command>make altinstall</command>: This make target omits some default
|
---|
| 242 | symbolic links that may interfere with Python 3.
|
---|
| 243 | </para>
|
---|
| 244 |
|
---|
[181662f] | 245 | <para>
|
---|
[0d7900a] | 246 | <command>chmod ...</command>: Fix permissions for libraries to be
|
---|
[181662f] | 247 | consistent with other libraries.
|
---|
| 248 | </para>
|
---|
[82fac2c] | 249 |
|
---|
[bf847d6d] | 250 | </sect2>
|
---|
| 251 |
|
---|
| 252 | <sect2 role="configuration">
|
---|
| 253 | <title>Configuring Python 2</title>
|
---|
| 254 |
|
---|
[181662f] | 255 | <para>
|
---|
| 256 | In order for <command>python</command> to find the installed
|
---|
| 257 | documentation, you must add the following environment variable to
|
---|
| 258 | individual user's or the system's profile:
|
---|
| 259 | </para>
|
---|
[bf847d6d] | 260 |
|
---|
[03d30cf] | 261 | <screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-&python2-version;</userinput></screen>
|
---|
[82fac2c] | 262 |
|
---|
[bf847d6d] | 263 | </sect2>
|
---|
| 264 |
|
---|
| 265 | <sect2 role="content">
|
---|
| 266 | <title>Contents</title>
|
---|
| 267 |
|
---|
| 268 | <segmentedlist>
|
---|
| 269 | <segtitle>Installed Programs</segtitle>
|
---|
[03d30cf] | 270 | <segtitle>Installed Library</segtitle>
|
---|
[bf847d6d] | 271 | <segtitle>Installed Directories</segtitle>
|
---|
| 272 |
|
---|
| 273 | <seglistitem>
|
---|
[181662f] | 274 | <seg>
|
---|
[61f684f2] | 275 | pydoc,
|
---|
| 276 | python2 (symlink),
|
---|
| 277 | python2-config (symlink),
|
---|
| 278 | python&python2-majorver;,
|
---|
| 279 | python&python2-majorver;-config,
|
---|
| 280 | smtpd.py, and
|
---|
| 281 | idle
|
---|
[181662f] | 282 | </seg>
|
---|
| 283 | <seg>
|
---|
[03d30cf] | 284 | libpython&python2-majorver;.so
|
---|
[181662f] | 285 | </seg>
|
---|
| 286 | <seg>
|
---|
[fcabde3c] | 287 | /usr/{include,lib}/python&python2-majorver; and
|
---|
| 288 | /usr/share/doc/python-&python2-version;
|
---|
| 289 | </seg>
|
---|
[bf847d6d] | 290 | </seglistitem>
|
---|
| 291 | </segmentedlist>
|
---|
| 292 |
|
---|
| 293 | <variablelist>
|
---|
| 294 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 295 | <?dbfo list-presentation="list"?>
|
---|
| 296 | <?dbhtml list-presentation="table"?>
|
---|
| 297 |
|
---|
[03d30cf] | 298 | <varlistentry id="idle">
|
---|
[bf847d6d] | 299 | <term><command>idle</command></term>
|
---|
| 300 | <listitem>
|
---|
[181662f] | 301 | <para>
|
---|
| 302 | is a wrapper script that opens a <application>Python</application>
|
---|
[d0aecd33] | 303 | aware GUI editor. For this script to run, you must have installed
|
---|
| 304 | <application>Tk</application> before Python so that the Tkinter
|
---|
[4c24eb0a] | 305 | Python module is built
|
---|
[181662f] | 306 | </para>
|
---|
[03d30cf] | 307 | <indexterm zone="python2 idle">
|
---|
| 308 | <primary sortas="b-idle">idle</primary>
|
---|
[bf847d6d] | 309 | </indexterm>
|
---|
| 310 | </listitem>
|
---|
| 311 | </varlistentry>
|
---|
| 312 |
|
---|
| 313 | <varlistentry id="pydoc2">
|
---|
| 314 | <term><command>pydoc</command></term>
|
---|
| 315 | <listitem>
|
---|
[181662f] | 316 | <para>
|
---|
[4c24eb0a] | 317 | is the <application>Python</application> documentation tool
|
---|
[181662f] | 318 | </para>
|
---|
[4716d52] | 319 | <indexterm zone="python2 pydoc2">
|
---|
[bf847d6d] | 320 | <primary sortas="b-pydoc2">pydoc</primary>
|
---|
| 321 | </indexterm>
|
---|
| 322 | </listitem>
|
---|
| 323 | </varlistentry>
|
---|
| 324 |
|
---|
[181662f] | 325 | <varlistentry id="python">
|
---|
[61f684f2] | 326 | <term><command>python2</command></term>
|
---|
[bf847d6d] | 327 | <listitem>
|
---|
[181662f] | 328 | <para>
|
---|
| 329 | is an interpreted, interactive, object-oriented programming
|
---|
[4c24eb0a] | 330 | language
|
---|
[181662f] | 331 | </para>
|
---|
| 332 | <indexterm zone="python2 python">
|
---|
[4716d52] | 333 | <primary sortas="b-python2">python</primary>
|
---|
[bf847d6d] | 334 | </indexterm>
|
---|
| 335 | </listitem>
|
---|
| 336 | </varlistentry>
|
---|
| 337 |
|
---|
| 338 | <varlistentry id="python2-ver">
|
---|
| 339 | <term><command>python&python2-majorver;</command></term>
|
---|
| 340 | <listitem>
|
---|
[181662f] | 341 | <para>
|
---|
| 342 | is a version-specific name for the <command>python</command>
|
---|
[4c24eb0a] | 343 | program
|
---|
[181662f] | 344 | </para>
|
---|
[4716d52] | 345 | <indexterm zone="python2 python2-ver">
|
---|
[b88be39] | 346 | <primary sortas="b-python&python2-majorver;">python&python2-majorver;</primary>
|
---|
[bf847d6d] | 347 | </indexterm>
|
---|
| 348 | </listitem>
|
---|
| 349 | </varlistentry>
|
---|
| 350 |
|
---|
[03d30cf] | 351 | <varlistentry id="smtpd.py">
|
---|
[bf847d6d] | 352 | <term><command>smtpd.py</command></term>
|
---|
| 353 | <listitem>
|
---|
[181662f] | 354 | <para>
|
---|
[4c24eb0a] | 355 | is an SMTP proxy implemented in <application>Python</application>
|
---|
[181662f] | 356 | </para>
|
---|
[03d30cf] | 357 | <indexterm zone="python2 smtpd.py">
|
---|
| 358 | <primary sortas="b-smtpd.py">smtpd.py</primary>
|
---|
[bf847d6d] | 359 | </indexterm>
|
---|
| 360 | </listitem>
|
---|
| 361 | </varlistentry>
|
---|
[82fac2c] | 362 |
|
---|
[bf847d6d] | 363 | </variablelist>
|
---|
[82fac2c] | 364 |
|
---|
[bf847d6d] | 365 | </sect2>
|
---|
[82fac2c] | 366 |
|
---|
[bf847d6d] | 367 | </sect1>
|
---|