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