[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"> -->
|
---|
[bf847d6d] | 11 | <!ENTITY python2-md5sum "75c87a80c6ddb0b785a57ea3583e04fa">
|
---|
| 12 | <!ENTITY python2-size "9.5 MB">
|
---|
| 13 | <!ENTITY python2-buildsize "235 MB (not including the test suite)">
|
---|
| 14 | <!ENTITY python2-time "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">
|
---|
[bf847d6d] | 17 | <!ENTITY python2htmldoc-md5sum "40f0bd51b221662cae14fb0c6b6f622b">
|
---|
| 18 | <!ENTITY python2htmldoc-size "4.1 MB">
|
---|
| 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 |
|
---|
[4c77a949] | 46 | &lfs71_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),
|
---|
| 117 | <ulink url="http://www.bluez.org/">BlueZ</ulink>,
|
---|
| 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>),
|
---|
| 122 | <xref linkend="db"/> and
|
---|
| 123 | <xref linkend="sqlite"/>.
|
---|
| 124 | </para>
|
---|
| 125 |
|
---|
| 126 | <para condition="html" role="usernotes">
|
---|
| 127 | User Notes: <ulink url="&blfs-wiki;/Python"/>
|
---|
| 128 | </para>
|
---|
[bf847d6d] | 129 | </sect2>
|
---|
| 130 |
|
---|
| 131 | <sect2 role="installation">
|
---|
| 132 | <title>Installation of Python</title>
|
---|
| 133 |
|
---|
[181662f] | 134 | <para>
|
---|
| 135 | Install <application>Python</application> by running the following
|
---|
| 136 | commands:
|
---|
| 137 | </para>
|
---|
[bf847d6d] | 138 |
|
---|
[a66801a] | 139 | <screen><userinput>sed -i "s/ndbm_libs = \[\]/ndbm_libs = ['gdbm', 'gdbm_compat']/" setup.py &&
|
---|
| 140 | ./configure --prefix=/usr --enable-shared &&
|
---|
[bf847d6d] | 141 | make</userinput></screen>
|
---|
| 142 |
|
---|
[181662f] | 143 | <para>
|
---|
| 144 | To test the results, issue: <command>make test</command>.
|
---|
| 145 | </para>
|
---|
[bf847d6d] | 146 |
|
---|
[181662f] | 147 | <para>
|
---|
| 148 | In order to use the <command>help ('name_string')</command> feature of the
|
---|
| 149 | <command>python</command> interpreter with some statements and keywords,
|
---|
| 150 | you must create or download the optional HTML documentation.
|
---|
| 151 | </para>
|
---|
| 152 |
|
---|
| 153 | <para>
|
---|
| 154 | If you have installed <ulink url="http://sphinx.pocoo.org/">Sphinx</ulink>
|
---|
| 155 | and wish to create the HTML documentation:
|
---|
| 156 | </para>
|
---|
| 157 |
|
---|
| 158 | <screen><userinput>make -C Doc html</userinput></screen>
|
---|
| 159 |
|
---|
| 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>
|
---|
| 168 | If you created the html documentation with
|
---|
| 169 | <application>Sphinx</application> then install it as the
|
---|
| 170 | <systemitem class="username">root</systemitem> user:
|
---|
| 171 | </para>
|
---|
[bf847d6d] | 172 |
|
---|
[181662f] | 173 | <screen role="root"><userinput>install -v -m755 -d /usr/share/doc/Python-&python2-version; &&
|
---|
| 174 | cp -rfv Doc/build/html/* /usr/share/doc/python-&python2-version;</userinput></screen>
|
---|
| 175 |
|
---|
| 176 | <para>
|
---|
| 177 | Alternatively, you can download preformatted documentation from
|
---|
| 178 | <ulink url="http://docs.python.org/download.html"/> and install it as the
|
---|
| 179 | <systemitem class="username">root</systemitem> user:
|
---|
| 180 | </para>
|
---|
| 181 |
|
---|
| 182 | <screen role="root"><userinput>install -v -m755 -d /usr/share/doc/Python-&python2-version; &&
|
---|
| 183 | tar --strip-components=1 -C /usr/share/doc/Python-&python2-version; \
|
---|
| 184 | -xvf ../python-&python2-version;-docs-html.tar.bz2</userinput></screen>
|
---|
[bf847d6d] | 185 | </sect2>
|
---|
| 186 |
|
---|
| 187 | <sect2 role="commands">
|
---|
| 188 | <title>Command Explanations</title>
|
---|
| 189 |
|
---|
[181662f] | 190 | <para>
|
---|
| 191 | <option>--with-system-ffi</option>: If you have installed
|
---|
| 192 | <application>Libffi</application> and
|
---|
| 193 | <application>Pkgconfig</application>, add this option to compile
|
---|
| 194 | <application>Python</application>'s _ctypes module using the system
|
---|
| 195 | installed <application>Libffi</application>. Otherwise
|
---|
| 196 | <application>Python</application> will compile its own copy of
|
---|
| 197 | <application>Libffi</application>.
|
---|
| 198 | </para>
|
---|
| 199 |
|
---|
[a66801a] | 200 | <para>
|
---|
| 201 | <command>sed -i "s/ndbm_libs = ..." setup.py</command>: This command is
|
---|
| 202 | used to fix a build problem with the <application>GDBM</application>
|
---|
| 203 | library.
|
---|
| 204 | </para>
|
---|
| 205 |
|
---|
[181662f] | 206 | <para>
|
---|
| 207 | <command>chmod ...</command>: Fix permissions for libraries to be
|
---|
| 208 | consistent with other libraries.
|
---|
| 209 | </para>
|
---|
[bf847d6d] | 210 | </sect2>
|
---|
| 211 |
|
---|
| 212 | <sect2 role="configuration">
|
---|
| 213 | <title>Configuring Python 2</title>
|
---|
| 214 |
|
---|
[181662f] | 215 | <para>
|
---|
| 216 | In order for <command>python</command> to find the installed
|
---|
| 217 | documentation, you must add the following environment variable to
|
---|
| 218 | individual user's or the system's profile:
|
---|
| 219 | </para>
|
---|
[bf847d6d] | 220 |
|
---|
[181662f] | 221 | <screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/Python-&python2-version;</userinput></screen>
|
---|
[bf847d6d] | 222 | </sect2>
|
---|
| 223 |
|
---|
| 224 | <sect2 role="content">
|
---|
| 225 | <title>Contents</title>
|
---|
| 226 |
|
---|
| 227 | <segmentedlist>
|
---|
| 228 | <segtitle>Installed Programs</segtitle>
|
---|
| 229 | <segtitle>Installed Libraries</segtitle>
|
---|
| 230 | <segtitle>Installed Directories</segtitle>
|
---|
| 231 |
|
---|
| 232 | <seglistitem>
|
---|
[181662f] | 233 | <seg>
|
---|
| 234 | pydoc, python, python-config, python&python2-majorver;,
|
---|
| 235 | python&python2-majorver;-config, smtpd.py, and optionally if
|
---|
| 236 | <application>Tk</application> is installed, idle
|
---|
| 237 | </seg>
|
---|
| 238 | <seg>
|
---|
| 239 | libpython&python2-majorver;.so and numerous modules installed in
|
---|
| 240 | /usr/lib/python&python2-majorver;/lib-dynload
|
---|
| 241 | </seg>
|
---|
| 242 | <seg>
|
---|
| 243 | /usr/include/python&python2-majorver;,
|
---|
| 244 | /usr/lib/python&python2-majorver;, and
|
---|
| 245 | /usr/share/doc/python-&python2-version;</seg>
|
---|
[bf847d6d] | 246 | </seglistitem>
|
---|
| 247 | </segmentedlist>
|
---|
| 248 |
|
---|
| 249 | <variablelist>
|
---|
| 250 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 251 | <?dbfo list-presentation="list"?>
|
---|
| 252 | <?dbhtml list-presentation="table"?>
|
---|
| 253 |
|
---|
| 254 | <varlistentry id="idle2">
|
---|
| 255 | <term><command>idle</command></term>
|
---|
| 256 | <listitem>
|
---|
[181662f] | 257 | <para>
|
---|
| 258 | is a wrapper script that opens a <application>Python</application>
|
---|
| 259 | aware GUI editor.
|
---|
| 260 | </para>
|
---|
[4716d52] | 261 | <indexterm zone="python2 idle2">
|
---|
[bf847d6d] | 262 | <primary sortas="b-idle2">idle</primary>
|
---|
| 263 | </indexterm>
|
---|
| 264 | </listitem>
|
---|
| 265 | </varlistentry>
|
---|
| 266 |
|
---|
| 267 | <varlistentry id="pydoc2">
|
---|
| 268 | <term><command>pydoc</command></term>
|
---|
| 269 | <listitem>
|
---|
[181662f] | 270 | <para>
|
---|
| 271 | is the <application>Python</application> documentation tool.
|
---|
| 272 | </para>
|
---|
[4716d52] | 273 | <indexterm zone="python2 pydoc2">
|
---|
[bf847d6d] | 274 | <primary sortas="b-pydoc2">pydoc</primary>
|
---|
| 275 | </indexterm>
|
---|
| 276 | </listitem>
|
---|
| 277 | </varlistentry>
|
---|
| 278 |
|
---|
[181662f] | 279 | <varlistentry id="python">
|
---|
[bf847d6d] | 280 | <term><command>python</command></term>
|
---|
| 281 | <listitem>
|
---|
[181662f] | 282 | <para>
|
---|
| 283 | is an interpreted, interactive, object-oriented programming
|
---|
| 284 | language.
|
---|
| 285 | </para>
|
---|
| 286 | <indexterm zone="python2 python">
|
---|
[4716d52] | 287 | <primary sortas="b-python2">python</primary>
|
---|
[bf847d6d] | 288 | </indexterm>
|
---|
| 289 | </listitem>
|
---|
| 290 | </varlistentry>
|
---|
| 291 |
|
---|
| 292 | <varlistentry id="python2-ver">
|
---|
| 293 | <term><command>python&python2-majorver;</command></term>
|
---|
| 294 | <listitem>
|
---|
[181662f] | 295 | <para>
|
---|
| 296 | is a version-specific name for the <command>python</command>
|
---|
| 297 | program.
|
---|
| 298 | </para>
|
---|
[4716d52] | 299 | <indexterm zone="python2 python2-ver">
|
---|
[b88be39] | 300 | <primary sortas="b-python&python2-majorver;">python&python2-majorver;</primary>
|
---|
[bf847d6d] | 301 | </indexterm>
|
---|
| 302 | </listitem>
|
---|
| 303 | </varlistentry>
|
---|
| 304 |
|
---|
| 305 | <varlistentry id="smtpd.py2">
|
---|
| 306 | <term><command>smtpd.py</command></term>
|
---|
| 307 | <listitem>
|
---|
[181662f] | 308 | <para>
|
---|
| 309 | is an SMTP proxy implemented in <application>Python</application>.
|
---|
| 310 | </para>
|
---|
[4716d52] | 311 | <indexterm zone="python2 smtpd.py2">
|
---|
[bf847d6d] | 312 | <primary sortas="b-smtpd.py2">smtpd.py</primary>
|
---|
| 313 | </indexterm>
|
---|
| 314 | </listitem>
|
---|
| 315 | </varlistentry>
|
---|
| 316 | </variablelist>
|
---|
| 317 | </sect2>
|
---|
| 318 | </sect1>
|
---|