[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
|
---|
| 8 | "http://www.python.org/ftp/python/&python2-version;/Python-&python2-version;.tar.xz">
|
---|
[27d9434] | 9 | <!ENTITY python2-download-ftp " ">
|
---|
| 10 | <!-- <!ENTITY python2-download-ftp "&gentoo-ftp-repo;/Python-&python2-version;.tar.xz"> -->
|
---|
[62f9a8e] | 11 | <!ENTITY python2-md5sum "62c4c1699170078c469f79ddfed21bc0">
|
---|
| 12 | <!ENTITY python2-size "9.6 MB">
|
---|
[bf847d6d] | 13 | <!ENTITY python2-buildsize "235 MB (not including the test suite)">
|
---|
[62f9a8e] | 14 | <!ENTITY python2-time "1.1 SBU (not including the test suite)">
|
---|
[181662f] | 15 | <!ENTITY python2htmldoc-download-http
|
---|
| 16 | "http://docs.python.org/ftp/python/doc/&python2-version;/python-&python2-version;-docs-html.tar.bz2">
|
---|
[62f9a8e] | 17 | <!ENTITY python2htmldoc-md5sum "101c13d39f76fd6706aac3a9196b2f01">
|
---|
| 18 | <!ENTITY python2htmldoc-size "4.2 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">
|
---|
[bf847d6d] | 32 | <primary sortas="a-Python2">Python</primary>
|
---|
| 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
|
---|
| 40 | <application>Python</application> development environment. This is useful
|
---|
| 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 |
|
---|
[ba291e0] | 46 | &lfs72_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 |
|
---|
| 82 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
| 83 |
|
---|
[4716d52] | 84 | <itemizedlist spacing="compact">
|
---|
[bf847d6d] | 85 | <title>Optional HTML Documentation</title>
|
---|
| 86 | <listitem>
|
---|
[181662f] | 87 | <para>
|
---|
| 88 | Download (HTTP): <ulink url="&python2htmldoc-download-http;"/>
|
---|
| 89 | </para>
|
---|
[bf847d6d] | 90 | </listitem>
|
---|
| 91 | <listitem>
|
---|
[181662f] | 92 | <para>
|
---|
| 93 | Download MD5 sum: &python2htmldoc-md5sum;
|
---|
| 94 | </para>
|
---|
[bf847d6d] | 95 | </listitem>
|
---|
| 96 | <listitem>
|
---|
[181662f] | 97 | <para>
|
---|
| 98 | Download size: &python2htmldoc-size;
|
---|
| 99 | </para>
|
---|
[bf847d6d] | 100 | </listitem>
|
---|
| 101 | </itemizedlist>
|
---|
| 102 |
|
---|
| 103 | <bridgehead renderas="sect3">Python Dependencies</bridgehead>
|
---|
| 104 |
|
---|
| 105 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[181662f] | 106 | <para role="optional">
|
---|
| 107 | <!-- <xref linkend="pth"/> can only be used if you've overwritten glibc's
|
---|
| 108 | libpthread. -->
|
---|
| 109 | <xref linkend="libffi"/> and <xref linkend="pkgconfig"/>
|
---|
| 110 | (<command>configure</command> uses <command>pkgconfig</command> to find
|
---|
| 111 | <application>libffi</application>. There is a circular dependency here:
|
---|
| 112 | <application>Pkgconfig</application> requires
|
---|
| 113 | <application>Glib</application> which requires
|
---|
| 114 | <application>Python 2</application>),
|
---|
| 115 | <!-- gcc's libffi does not install a pkgconfig file -->
|
---|
| 116 | <ulink url="http://sphinx.pocoo.org/">Sphinx</ulink> (to create the docs),
|
---|
[c80db1b] | 117 | <xref linkend="bluez"/>,
|
---|
[181662f] | 118 | <xref linkend="openssl"/>,
|
---|
| 119 | <xref linkend="tk"/> (there is a circular dependency with the
|
---|
| 120 | <application>Tk</application> package as it requires Xorg to be installed
|
---|
| 121 | but parts of Xorg depend on <application>Python</application>),
|
---|
[62f9a8e] | 122 | <!--<xref linkend="db"/> and-->
|
---|
| 123 | <ulink
|
---|
| 124 | url="http://www.oracle.com/technetwork/products/berkeleydb/downloads/">BerkeleyDB</ulink>
|
---|
| 125 | (only versions up to 4.8), and
|
---|
[181662f] | 126 | <xref linkend="sqlite"/>.
|
---|
| 127 | </para>
|
---|
| 128 |
|
---|
| 129 | <para condition="html" role="usernotes">
|
---|
| 130 | User Notes: <ulink url="&blfs-wiki;/Python"/>
|
---|
| 131 | </para>
|
---|
[bf847d6d] | 132 | </sect2>
|
---|
| 133 |
|
---|
| 134 | <sect2 role="installation">
|
---|
| 135 | <title>Installation of Python</title>
|
---|
| 136 |
|
---|
[181662f] | 137 | <para>
|
---|
| 138 | Install <application>Python</application> by running the following
|
---|
| 139 | commands:
|
---|
| 140 | </para>
|
---|
[bf847d6d] | 141 |
|
---|
[a66801a] | 142 | <screen><userinput>sed -i "s/ndbm_libs = \[\]/ndbm_libs = ['gdbm', 'gdbm_compat']/" setup.py &&
|
---|
| 143 | ./configure --prefix=/usr --enable-shared &&
|
---|
[bf847d6d] | 144 | make</userinput></screen>
|
---|
| 145 |
|
---|
[181662f] | 146 | <para>
|
---|
| 147 | To test the results, issue: <command>make test</command>.
|
---|
| 148 | </para>
|
---|
[bf847d6d] | 149 |
|
---|
[181662f] | 150 | <para>
|
---|
| 151 | In order to use the <command>help ('name_string')</command> feature of the
|
---|
| 152 | <command>python</command> interpreter with some statements and keywords,
|
---|
| 153 | you must create or download the optional HTML documentation.
|
---|
| 154 | </para>
|
---|
| 155 |
|
---|
| 156 | <para>
|
---|
| 157 | If you have installed <ulink url="http://sphinx.pocoo.org/">Sphinx</ulink>
|
---|
| 158 | and wish to create the HTML documentation:
|
---|
| 159 | </para>
|
---|
| 160 |
|
---|
| 161 | <screen><userinput>make -C Doc html</userinput></screen>
|
---|
| 162 |
|
---|
| 163 | <para>
|
---|
| 164 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 165 | </para>
|
---|
[bf847d6d] | 166 |
|
---|
[7224506] | 167 | <screen role="root"><userinput>make install &&
|
---|
| 168 | chmod -v 755 /usr/lib/libpython&python2-majorver;.so.1.0</userinput></screen>
|
---|
[bf847d6d] | 169 |
|
---|
[181662f] | 170 | <para>
|
---|
| 171 | If you created the html documentation with
|
---|
| 172 | <application>Sphinx</application> then install it as the
|
---|
| 173 | <systemitem class="username">root</systemitem> user:
|
---|
| 174 | </para>
|
---|
[bf847d6d] | 175 |
|
---|
[181662f] | 176 | <screen role="root"><userinput>install -v -m755 -d /usr/share/doc/Python-&python2-version; &&
|
---|
| 177 | cp -rfv Doc/build/html/* /usr/share/doc/python-&python2-version;</userinput></screen>
|
---|
| 178 |
|
---|
| 179 | <para>
|
---|
| 180 | Alternatively, you can download preformatted documentation from
|
---|
| 181 | <ulink url="http://docs.python.org/download.html"/> and install it as the
|
---|
| 182 | <systemitem class="username">root</systemitem> user:
|
---|
| 183 | </para>
|
---|
| 184 |
|
---|
| 185 | <screen role="root"><userinput>install -v -m755 -d /usr/share/doc/Python-&python2-version; &&
|
---|
| 186 | tar --strip-components=1 -C /usr/share/doc/Python-&python2-version; \
|
---|
| 187 | -xvf ../python-&python2-version;-docs-html.tar.bz2</userinput></screen>
|
---|
[bf847d6d] | 188 | </sect2>
|
---|
| 189 |
|
---|
| 190 | <sect2 role="commands">
|
---|
| 191 | <title>Command Explanations</title>
|
---|
| 192 |
|
---|
[181662f] | 193 | <para>
|
---|
| 194 | <option>--with-system-ffi</option>: If you have installed
|
---|
| 195 | <application>Libffi</application> and
|
---|
| 196 | <application>Pkgconfig</application>, add this option to compile
|
---|
| 197 | <application>Python</application>'s _ctypes module using the system
|
---|
| 198 | installed <application>Libffi</application>. Otherwise
|
---|
| 199 | <application>Python</application> will compile its own copy of
|
---|
| 200 | <application>Libffi</application>.
|
---|
| 201 | </para>
|
---|
| 202 |
|
---|
[a66801a] | 203 | <para>
|
---|
| 204 | <command>sed -i "s/ndbm_libs = ..." setup.py</command>: This command is
|
---|
| 205 | used to fix a build problem with the <application>GDBM</application>
|
---|
| 206 | library.
|
---|
| 207 | </para>
|
---|
| 208 |
|
---|
[181662f] | 209 | <para>
|
---|
| 210 | <command>chmod ...</command>: Fix permissions for libraries to be
|
---|
| 211 | consistent with other libraries.
|
---|
| 212 | </para>
|
---|
[bf847d6d] | 213 | </sect2>
|
---|
| 214 |
|
---|
| 215 | <sect2 role="configuration">
|
---|
| 216 | <title>Configuring Python 2</title>
|
---|
| 217 |
|
---|
[181662f] | 218 | <para>
|
---|
| 219 | In order for <command>python</command> to find the installed
|
---|
| 220 | documentation, you must add the following environment variable to
|
---|
| 221 | individual user's or the system's profile:
|
---|
| 222 | </para>
|
---|
[bf847d6d] | 223 |
|
---|
[181662f] | 224 | <screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/Python-&python2-version;</userinput></screen>
|
---|
[bf847d6d] | 225 | </sect2>
|
---|
| 226 |
|
---|
| 227 | <sect2 role="content">
|
---|
| 228 | <title>Contents</title>
|
---|
| 229 |
|
---|
| 230 | <segmentedlist>
|
---|
| 231 | <segtitle>Installed Programs</segtitle>
|
---|
| 232 | <segtitle>Installed Libraries</segtitle>
|
---|
| 233 | <segtitle>Installed Directories</segtitle>
|
---|
| 234 |
|
---|
| 235 | <seglistitem>
|
---|
[181662f] | 236 | <seg>
|
---|
[62f9a8e] | 237 | 2to3, pydoc, python, python-config, python&python2-majorver;,
|
---|
[181662f] | 238 | python&python2-majorver;-config, smtpd.py, and optionally if
|
---|
| 239 | <application>Tk</application> is installed, idle
|
---|
| 240 | </seg>
|
---|
| 241 | <seg>
|
---|
| 242 | libpython&python2-majorver;.so and numerous modules installed in
|
---|
| 243 | /usr/lib/python&python2-majorver;/lib-dynload
|
---|
| 244 | </seg>
|
---|
| 245 | <seg>
|
---|
| 246 | /usr/include/python&python2-majorver;,
|
---|
| 247 | /usr/lib/python&python2-majorver;, and
|
---|
| 248 | /usr/share/doc/python-&python2-version;</seg>
|
---|
[bf847d6d] | 249 | </seglistitem>
|
---|
| 250 | </segmentedlist>
|
---|
| 251 |
|
---|
| 252 | <variablelist>
|
---|
| 253 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 254 | <?dbfo list-presentation="list"?>
|
---|
| 255 | <?dbhtml list-presentation="table"?>
|
---|
| 256 |
|
---|
[62f9a8e] | 257 | <varlistentry id="python2-2to3">
|
---|
| 258 | <term><command>2to3</command></term>
|
---|
| 259 | <listitem>
|
---|
| 260 | <para>
|
---|
| 261 | is a <application>Python</application> program that reads
|
---|
| 262 | <application>Python 2.x</application> source code and applies a series of
|
---|
| 263 | fixers to transform it into valid <application>Python 3.x</application>
|
---|
| 264 | code.
|
---|
| 265 | </para>
|
---|
| 266 | <indexterm zone="python2 python2-2to3">
|
---|
| 267 | <primary sortas="b-2to3">2to3</primary>
|
---|
| 268 | </indexterm>
|
---|
| 269 | </listitem>
|
---|
| 270 | </varlistentry>
|
---|
| 271 |
|
---|
[bf847d6d] | 272 | <varlistentry id="idle2">
|
---|
| 273 | <term><command>idle</command></term>
|
---|
| 274 | <listitem>
|
---|
[181662f] | 275 | <para>
|
---|
| 276 | is a wrapper script that opens a <application>Python</application>
|
---|
| 277 | aware GUI editor.
|
---|
| 278 | </para>
|
---|
[4716d52] | 279 | <indexterm zone="python2 idle2">
|
---|
[bf847d6d] | 280 | <primary sortas="b-idle2">idle</primary>
|
---|
| 281 | </indexterm>
|
---|
| 282 | </listitem>
|
---|
| 283 | </varlistentry>
|
---|
| 284 |
|
---|
| 285 | <varlistentry id="pydoc2">
|
---|
| 286 | <term><command>pydoc</command></term>
|
---|
| 287 | <listitem>
|
---|
[181662f] | 288 | <para>
|
---|
| 289 | is the <application>Python</application> documentation tool.
|
---|
| 290 | </para>
|
---|
[4716d52] | 291 | <indexterm zone="python2 pydoc2">
|
---|
[bf847d6d] | 292 | <primary sortas="b-pydoc2">pydoc</primary>
|
---|
| 293 | </indexterm>
|
---|
| 294 | </listitem>
|
---|
| 295 | </varlistentry>
|
---|
| 296 |
|
---|
[181662f] | 297 | <varlistentry id="python">
|
---|
[bf847d6d] | 298 | <term><command>python</command></term>
|
---|
| 299 | <listitem>
|
---|
[181662f] | 300 | <para>
|
---|
| 301 | is an interpreted, interactive, object-oriented programming
|
---|
| 302 | language.
|
---|
| 303 | </para>
|
---|
| 304 | <indexterm zone="python2 python">
|
---|
[4716d52] | 305 | <primary sortas="b-python2">python</primary>
|
---|
[bf847d6d] | 306 | </indexterm>
|
---|
| 307 | </listitem>
|
---|
| 308 | </varlistentry>
|
---|
| 309 |
|
---|
| 310 | <varlistentry id="python2-ver">
|
---|
| 311 | <term><command>python&python2-majorver;</command></term>
|
---|
| 312 | <listitem>
|
---|
[181662f] | 313 | <para>
|
---|
| 314 | is a version-specific name for the <command>python</command>
|
---|
| 315 | program.
|
---|
| 316 | </para>
|
---|
[4716d52] | 317 | <indexterm zone="python2 python2-ver">
|
---|
[b88be39] | 318 | <primary sortas="b-python&python2-majorver;">python&python2-majorver;</primary>
|
---|
[bf847d6d] | 319 | </indexterm>
|
---|
| 320 | </listitem>
|
---|
| 321 | </varlistentry>
|
---|
| 322 |
|
---|
| 323 | <varlistentry id="smtpd.py2">
|
---|
| 324 | <term><command>smtpd.py</command></term>
|
---|
| 325 | <listitem>
|
---|
[181662f] | 326 | <para>
|
---|
| 327 | is an SMTP proxy implemented in <application>Python</application>.
|
---|
| 328 | </para>
|
---|
[4716d52] | 329 | <indexterm zone="python2 smtpd.py2">
|
---|
[bf847d6d] | 330 | <primary sortas="b-smtpd.py2">smtpd.py</primary>
|
---|
| 331 | </indexterm>
|
---|
| 332 | </listitem>
|
---|
| 333 | </varlistentry>
|
---|
| 334 | </variablelist>
|
---|
| 335 | </sect2>
|
---|
| 336 | </sect1>
|
---|