[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.
|
---|
| 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 |
|
---|
[82bdecf] | 58 | &lfs90_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>
|
---|
[cac7f93] | 123 |
|
---|
[181662f] | 124 | <para condition="html" role="usernotes">
|
---|
| 125 | User Notes: <ulink url="&blfs-wiki;/Python"/>
|
---|
| 126 | </para>
|
---|
[bf847d6d] | 127 | </sect2>
|
---|
| 128 |
|
---|
| 129 | <sect2 role="installation">
|
---|
[03d30cf] | 130 | <title>Installation of Python 2</title>
|
---|
[bf847d6d] | 131 |
|
---|
[4343801] | 132 | <caution>
|
---|
| 133 | <para>
|
---|
[420d60b] | 134 | After installing this package or
|
---|
| 135 | updating <application>pip2</application> with the command
|
---|
[4343801] | 136 | <command>pip2 install --upgrade pip</command>, it will remove
|
---|
[420d60b] | 137 | <application>pip3</application> installed in LFS. To reset
|
---|
[4343801] | 138 | <application>pip</application> and <application>pip3</application>,
|
---|
| 139 | run, as the <systemitem class="username">root</systemitem> user:
|
---|
| 140 | </para>
|
---|
| 141 |
|
---|
| 142 | <screen role="nodump"><userinput>python3 -m pip install --force pip</userinput></screen>
|
---|
| 143 | </caution>
|
---|
| 144 |
|
---|
[181662f] | 145 | <para>
|
---|
[03d30cf] | 146 | Install <application>Python 2</application> by running the following
|
---|
[181662f] | 147 | commands:
|
---|
| 148 | </para>
|
---|
[bf847d6d] | 149 |
|
---|
[167a240] | 150 | <screen><userinput>./configure --prefix=/usr \
|
---|
[82fac2c] | 151 | --enable-shared \
|
---|
| 152 | --with-system-expat \
|
---|
| 153 | --with-system-ffi \
|
---|
[879932f] | 154 | --with-ensurepip=yes \
|
---|
[82fac2c] | 155 | --enable-unicode=ucs4 &&
|
---|
[bf847d6d] | 156 | make</userinput></screen>
|
---|
| 157 |
|
---|
[167a240] | 158 | <para>
|
---|
[1a64240] | 159 | To test the results, issue: <command>make -k test</command>.
|
---|
[181662f] | 160 | </para>
|
---|
[bf847d6d] | 161 |
|
---|
[181662f] | 162 | <para>
|
---|
| 163 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 164 | </para>
|
---|
[bf847d6d] | 165 |
|
---|
[7224506] | 166 | <screen role="root"><userinput>make install &&
|
---|
| 167 | chmod -v 755 /usr/lib/libpython&python2-majorver;.so.1.0</userinput></screen>
|
---|
[bf847d6d] | 168 |
|
---|
[181662f] | 169 | <para>
|
---|
[7fe0ce3b] | 170 | Since <application>Python 2</application> is in maintenance mode, and
|
---|
| 171 | <application>Python 3</application> is recommended by upstream for
|
---|
[8b9b43e] | 172 | development, you probably do not need to install the documentation.
|
---|
[7fe0ce3b] | 173 | However, if you still want to install documentation for both
|
---|
[8b9b43e] | 174 | <application>Python</application> versions, be sure to define the
|
---|
| 175 | <envar>PYTHONDOCS</envar>
|
---|
[7fe0ce3b] | 176 | variable for the version you want to use, each time you need to consult
|
---|
| 177 | the documentation. If you have downloaded the preformatted documentation
|
---|
| 178 | from <ulink url="http://docs.python.org/download.html"/>, install it
|
---|
[03d30cf] | 179 | as the <systemitem class="username">root</systemitem> user:
|
---|
[181662f] | 180 | </para>
|
---|
| 181 |
|
---|
[23d3543c] | 182 | <screen role="root"><userinput>install -v -dm755 /usr/share/doc/python-&python2-version; &&
|
---|
[7b273030] | 183 |
|
---|
| 184 | tar --strip-components=1 \
|
---|
| 185 | --no-same-owner \
|
---|
| 186 | --directory /usr/share/doc/python-&python2-version; \
|
---|
| 187 | -xvf ../python-&python2-version;-docs-html.tar.bz2 &&
|
---|
| 188 |
|
---|
[03d30cf] | 189 | find /usr/share/doc/python-&python2-version; -type d -exec chmod 0755 {} \; &&
|
---|
| 190 | find /usr/share/doc/python-&python2-version; -type f -exec chmod 0644 {} \;</userinput></screen>
|
---|
[bf847d6d] | 191 | </sect2>
|
---|
| 192 |
|
---|
| 193 | <sect2 role="commands">
|
---|
| 194 | <title>Command Explanations</title>
|
---|
| 195 |
|
---|
[82fac2c] | 196 | <para>
|
---|
[00ff1df] | 197 | <parameter>--with-system-expat</parameter>: This switch enables linking
|
---|
| 198 | against system version of <application>Expat</application>.
|
---|
[82fac2c] | 199 | </para>
|
---|
| 200 |
|
---|
| 201 | <para>
|
---|
[00ff1df] | 202 | <parameter>--with-system-ffi</parameter>: This switch enables linking
|
---|
[60ddbaf] | 203 | against system version of <application>libffi</application>.
|
---|
[82fac2c] | 204 | </para>
|
---|
| 205 |
|
---|
[23c5563] | 206 | <para>
|
---|
| 207 | <parameter>--with-ensurepip=yes</parameter> : This switch enables building
|
---|
| 208 | <command>pip</command> and <command>setuptools</command> packaging programs.
|
---|
| 209 | <command>setuptools</command> is needed for building some Python modules.
|
---|
| 210 | </para>
|
---|
| 211 |
|
---|
[82fac2c] | 212 | <para>
|
---|
| 213 | <parameter>--enable-unicode=ucs4</parameter>: This switch enables
|
---|
| 214 | 32bit Unicode support in <application>Python</application>.
|
---|
| 215 | </para>
|
---|
| 216 |
|
---|
| 217 | <para>
|
---|
[00ff1df] | 218 | <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
|
---|
[0d7900a] | 219 | if you want to build <application>Python</application> DBM Module
|
---|
[82fac2c] | 220 | against <application>Berkeley DB</application> instead of
|
---|
| 221 | <application>GDBM</application>.
|
---|
| 222 | </para>
|
---|
| 223 |
|
---|
[181662f] | 224 | <para>
|
---|
[0d7900a] | 225 | <command>chmod ...</command>: Fix permissions for libraries to be
|
---|
[181662f] | 226 | consistent with other libraries.
|
---|
| 227 | </para>
|
---|
[82fac2c] | 228 |
|
---|
[bf847d6d] | 229 | </sect2>
|
---|
| 230 |
|
---|
| 231 | <sect2 role="configuration">
|
---|
| 232 | <title>Configuring Python 2</title>
|
---|
| 233 |
|
---|
[181662f] | 234 | <para>
|
---|
| 235 | In order for <command>python</command> to find the installed
|
---|
| 236 | documentation, you must add the following environment variable to
|
---|
| 237 | individual user's or the system's profile:
|
---|
| 238 | </para>
|
---|
[bf847d6d] | 239 |
|
---|
[03d30cf] | 240 | <screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-&python2-version;</userinput></screen>
|
---|
[82fac2c] | 241 |
|
---|
[bf847d6d] | 242 | </sect2>
|
---|
| 243 |
|
---|
| 244 | <sect2 role="content">
|
---|
| 245 | <title>Contents</title>
|
---|
| 246 |
|
---|
| 247 | <segmentedlist>
|
---|
| 248 | <segtitle>Installed Programs</segtitle>
|
---|
[03d30cf] | 249 | <segtitle>Installed Library</segtitle>
|
---|
[bf847d6d] | 250 | <segtitle>Installed Directories</segtitle>
|
---|
| 251 |
|
---|
| 252 | <seglistitem>
|
---|
[181662f] | 253 | <seg>
|
---|
[4343801] | 254 | 2to3, pip2, pydoc, python (symlink), python-config (symlink),
|
---|
[167a240] | 255 | python2 (symlink), python2-config (symlink),
|
---|
[03d30cf] | 256 | python&python2-majorver;, python&python2-majorver;-config,
|
---|
[d0aecd33] | 257 | smtpd.py, and idle
|
---|
[181662f] | 258 | </seg>
|
---|
| 259 | <seg>
|
---|
[03d30cf] | 260 | libpython&python2-majorver;.so
|
---|
[181662f] | 261 | </seg>
|
---|
| 262 | <seg>
|
---|
[fcabde3c] | 263 | /usr/{include,lib}/python&python2-majorver; and
|
---|
| 264 | /usr/share/doc/python-&python2-version;
|
---|
| 265 | </seg>
|
---|
[bf847d6d] | 266 | </seglistitem>
|
---|
| 267 | </segmentedlist>
|
---|
| 268 |
|
---|
| 269 | <variablelist>
|
---|
| 270 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 271 | <?dbfo list-presentation="list"?>
|
---|
| 272 | <?dbhtml list-presentation="table"?>
|
---|
| 273 |
|
---|
[62f9a8e] | 274 | <varlistentry id="python2-2to3">
|
---|
| 275 | <term><command>2to3</command></term>
|
---|
| 276 | <listitem>
|
---|
| 277 | <para>
|
---|
| 278 | is a <application>Python</application> program that reads
|
---|
[00ff1df] | 279 | <application>Python 2.x</application> source code and applies a
|
---|
| 280 | series of fixes to transform it into valid
|
---|
| 281 | <application>Python 3.x</application> code.
|
---|
[62f9a8e] | 282 | </para>
|
---|
| 283 | <indexterm zone="python2 python2-2to3">
|
---|
| 284 | <primary sortas="b-2to3">2to3</primary>
|
---|
| 285 | </indexterm>
|
---|
| 286 | </listitem>
|
---|
| 287 | </varlistentry>
|
---|
| 288 |
|
---|
[4343801] | 289 | <varlistentry id="pip2">
|
---|
| 290 | <term><command>pip2</command></term>
|
---|
| 291 | <listitem>
|
---|
| 292 | <para>
|
---|
| 293 | is the package manager for <application>Python 2.x</application>.
|
---|
| 294 | It is used to automate management of
|
---|
| 295 | <application>Python 2.x</application> modules.
|
---|
| 296 | </para>
|
---|
| 297 | <indexterm zone="python2 pip2">
|
---|
| 298 | <primary sortas="b-pip2">pip2</primary>
|
---|
| 299 | </indexterm>
|
---|
| 300 | </listitem>
|
---|
| 301 | </varlistentry>
|
---|
| 302 |
|
---|
[03d30cf] | 303 | <varlistentry id="idle">
|
---|
[bf847d6d] | 304 | <term><command>idle</command></term>
|
---|
| 305 | <listitem>
|
---|
[181662f] | 306 | <para>
|
---|
| 307 | is a wrapper script that opens a <application>Python</application>
|
---|
[d0aecd33] | 308 | aware GUI editor. For this script to run, you must have installed
|
---|
| 309 | <application>Tk</application> before Python so that the Tkinter
|
---|
| 310 | Python module is built.
|
---|
[181662f] | 311 | </para>
|
---|
[03d30cf] | 312 | <indexterm zone="python2 idle">
|
---|
| 313 | <primary sortas="b-idle">idle</primary>
|
---|
[bf847d6d] | 314 | </indexterm>
|
---|
| 315 | </listitem>
|
---|
| 316 | </varlistentry>
|
---|
| 317 |
|
---|
| 318 | <varlistentry id="pydoc2">
|
---|
| 319 | <term><command>pydoc</command></term>
|
---|
| 320 | <listitem>
|
---|
[181662f] | 321 | <para>
|
---|
| 322 | is the <application>Python</application> documentation tool.
|
---|
| 323 | </para>
|
---|
[4716d52] | 324 | <indexterm zone="python2 pydoc2">
|
---|
[bf847d6d] | 325 | <primary sortas="b-pydoc2">pydoc</primary>
|
---|
| 326 | </indexterm>
|
---|
| 327 | </listitem>
|
---|
| 328 | </varlistentry>
|
---|
| 329 |
|
---|
[181662f] | 330 | <varlistentry id="python">
|
---|
[bf847d6d] | 331 | <term><command>python</command></term>
|
---|
| 332 | <listitem>
|
---|
[181662f] | 333 | <para>
|
---|
| 334 | is an interpreted, interactive, object-oriented programming
|
---|
| 335 | language.
|
---|
| 336 | </para>
|
---|
| 337 | <indexterm zone="python2 python">
|
---|
[4716d52] | 338 | <primary sortas="b-python2">python</primary>
|
---|
[bf847d6d] | 339 | </indexterm>
|
---|
| 340 | </listitem>
|
---|
| 341 | </varlistentry>
|
---|
| 342 |
|
---|
| 343 | <varlistentry id="python2-ver">
|
---|
| 344 | <term><command>python&python2-majorver;</command></term>
|
---|
| 345 | <listitem>
|
---|
[181662f] | 346 | <para>
|
---|
| 347 | is a version-specific name for the <command>python</command>
|
---|
| 348 | program.
|
---|
| 349 | </para>
|
---|
[4716d52] | 350 | <indexterm zone="python2 python2-ver">
|
---|
[b88be39] | 351 | <primary sortas="b-python&python2-majorver;">python&python2-majorver;</primary>
|
---|
[bf847d6d] | 352 | </indexterm>
|
---|
| 353 | </listitem>
|
---|
| 354 | </varlistentry>
|
---|
| 355 |
|
---|
[03d30cf] | 356 | <varlistentry id="smtpd.py">
|
---|
[bf847d6d] | 357 | <term><command>smtpd.py</command></term>
|
---|
| 358 | <listitem>
|
---|
[181662f] | 359 | <para>
|
---|
| 360 | is an SMTP proxy implemented in <application>Python</application>.
|
---|
| 361 | </para>
|
---|
[03d30cf] | 362 | <indexterm zone="python2 smtpd.py">
|
---|
| 363 | <primary sortas="b-smtpd.py">smtpd.py</primary>
|
---|
[bf847d6d] | 364 | </indexterm>
|
---|
| 365 | </listitem>
|
---|
| 366 | </varlistentry>
|
---|
[82fac2c] | 367 |
|
---|
[bf847d6d] | 368 | </variablelist>
|
---|
[82fac2c] | 369 |
|
---|
[bf847d6d] | 370 | </sect2>
|
---|
[82fac2c] | 371 |
|
---|
[bf847d6d] | 372 | </sect1>
|
---|