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 |
|
---|
7 | <!ENTITY python3-download-http
|
---|
8 | "https://www.python.org/ftp/python/&python3-version;/Python-&python3-version;.tar.xz">
|
---|
9 | <!ENTITY python3-download-ftp " ">
|
---|
10 | <!ENTITY python3-md5sum "e92356b012ed4d0e09675131d39b1bde">
|
---|
11 | <!ENTITY python3-size "19 MB">
|
---|
12 | <!ENTITY python3-buildsize "202 MB (add 23 MB for tests)">
|
---|
13 | <!ENTITY python3-time "2.3 SBU (add 1.7 SBU for tests; both using parallelism=4)">
|
---|
14 | <!--
|
---|
15 | Note: Size does not reflect docs that were install in LFS.
|
---|
16 | -->
|
---|
17 | <!ENTITY python3htmldoc-download-http
|
---|
18 | "https://www.python.org/ftp/python/doc/&python3-version;/python-&python3-version;-docs-html.tar.bz2">
|
---|
19 | <!ENTITY python3-docs-md5sum "e19fa51f7055c0e869d609f2dfbcc5d9" >
|
---|
20 | ]>
|
---|
21 |
|
---|
22 | <sect1 id="python3" xreflabel="Python-&python3-version;">
|
---|
23 | <?dbhtml filename="python3.html" ?>
|
---|
24 |
|
---|
25 | <sect1info>
|
---|
26 | <date>$Date$</date>
|
---|
27 | </sect1info>
|
---|
28 |
|
---|
29 | <title>Python-&python3-version;</title>
|
---|
30 |
|
---|
31 | <indexterm zone="python3">
|
---|
32 | <primary sortas="a-Python3">Python3</primary>
|
---|
33 | </indexterm>
|
---|
34 |
|
---|
35 | <sect2 role="package">
|
---|
36 | <title>Introduction to Python 3</title>
|
---|
37 |
|
---|
38 | <para>
|
---|
39 | The <application>Python 3</application> package contains the
|
---|
40 | <application>Python</application> development environment.
|
---|
41 | This is useful for object-oriented programming, writing scripts,
|
---|
42 | prototyping large programs or developing entire applications.
|
---|
43 | </para>
|
---|
44 |
|
---|
45 | <note>
|
---|
46 | <para>
|
---|
47 | <application>Python 3</application> was installed in LFS.
|
---|
48 | The only reason to rebuild it here is if optional modules
|
---|
49 | are needed, or to upgrade this package.
|
---|
50 | </para>
|
---|
51 | </note>
|
---|
52 |
|
---|
53 | &lfs112_checked;
|
---|
54 |
|
---|
55 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
56 | <itemizedlist spacing="compact">
|
---|
57 | <listitem>
|
---|
58 | <para>
|
---|
59 | Download (HTTP): <ulink url="&python3-download-http;"/>
|
---|
60 | </para>
|
---|
61 | </listitem>
|
---|
62 | <listitem>
|
---|
63 | <para>
|
---|
64 | Download (FTP): <ulink url="&python3-download-ftp;"/>
|
---|
65 | </para>
|
---|
66 | </listitem>
|
---|
67 | <listitem>
|
---|
68 | <para>
|
---|
69 | Download MD5 sum: &python3-md5sum;
|
---|
70 | </para>
|
---|
71 | </listitem>
|
---|
72 | <listitem>
|
---|
73 | <para>
|
---|
74 | Download size: &python3-size;
|
---|
75 | </para>
|
---|
76 | </listitem>
|
---|
77 | <listitem>
|
---|
78 | <para>
|
---|
79 | Estimated disk space required: &python3-buildsize;
|
---|
80 | </para>
|
---|
81 | </listitem>
|
---|
82 | <listitem>
|
---|
83 | <para>
|
---|
84 | Estimated build time: &python3-time;
|
---|
85 | </para>
|
---|
86 | </listitem>
|
---|
87 | </itemizedlist>
|
---|
88 |
|
---|
89 | <bridgehead renderas="sect3">Additional Optional Download</bridgehead>
|
---|
90 | <itemizedlist spacing="compact">
|
---|
91 | <listitem>
|
---|
92 | <para>
|
---|
93 | Download (HTTP): <ulink url="&python3htmldoc-download-http;"/>
|
---|
94 | </para>
|
---|
95 | </listitem>
|
---|
96 | <listitem>
|
---|
97 | <para>
|
---|
98 | Download MD5 sum: &python3-docs-md5sum;
|
---|
99 | </para>
|
---|
100 | </listitem>
|
---|
101 | </itemizedlist>
|
---|
102 |
|
---|
103 | <bridgehead renderas="sect3">Python 3 Dependencies</bridgehead>
|
---|
104 |
|
---|
105 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
106 | <para role="recommended">
|
---|
107 | <xref linkend="sqlite"/> (required if building firefox or thunderbird)
|
---|
108 | </para>
|
---|
109 |
|
---|
110 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
111 | <para role="optional">
|
---|
112 | <xref linkend="bluez"/>,
|
---|
113 | <xref linkend="gdb"/> (required for some tests),
|
---|
114 | <xref linkend="valgrind"/>, and
|
---|
115 | <ulink url="https://www.bytereef.org/mpdecimal/">libmpdec</ulink>
|
---|
116 | </para>
|
---|
117 |
|
---|
118 | <bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
|
---|
119 | <para role="optional">
|
---|
120 | <xref linkend="db"/>,
|
---|
121 | <xref linkend="libnsl"/>, and
|
---|
122 | <xref linkend="tk"/>
|
---|
123 | </para>
|
---|
124 |
|
---|
125 | <para condition="html" role="usernotes">User Notes:
|
---|
126 | <ulink url="&blfs-wiki;/Python3"/>
|
---|
127 | </para>
|
---|
128 | </sect2>
|
---|
129 |
|
---|
130 | <sect2 role="installation">
|
---|
131 | <title>Installation of Python 3</title>
|
---|
132 |
|
---|
133 | <para>
|
---|
134 | Install <application>Python 3</application> by running the following
|
---|
135 | commands:
|
---|
136 | </para>
|
---|
137 |
|
---|
138 | <screen><userinput>CXX="/usr/bin/g++" \
|
---|
139 | ./configure --prefix=/usr \
|
---|
140 | --enable-shared \
|
---|
141 | --with-system-expat \
|
---|
142 | --with-system-ffi \
|
---|
143 | --enable-optimizations &&
|
---|
144 | make</userinput></screen>
|
---|
145 |
|
---|
146 | <para>
|
---|
147 | To test the result, issue <command>make test</command>.
|
---|
148 | Some tests may need an Internet connection. Two tests, test_distutils
|
---|
149 | and test_peg_generator are known to fail.
|
---|
150 | </para>
|
---|
151 |
|
---|
152 | <para>
|
---|
153 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
154 | </para>
|
---|
155 |
|
---|
156 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
157 |
|
---|
158 | <para>
|
---|
159 | If upgrading and the documentation has been downloaded, optionally install
|
---|
160 | it as the &root; user:
|
---|
161 | </para>
|
---|
162 |
|
---|
163 | <screen role="root"><userinput>tar --strip-components=1 \
|
---|
164 | --no-same-owner \
|
---|
165 | --no-same-permissions \
|
---|
166 | -C /usr/share/doc/python-&python3-version;/html \
|
---|
167 | -xvf ../python-&python3-version;-docs-html.tar.bz2</userinput></screen>
|
---|
168 |
|
---|
169 | </sect2>
|
---|
170 |
|
---|
171 | <sect2 role="commands">
|
---|
172 | <title>Command Explanations</title>
|
---|
173 |
|
---|
174 | <para>
|
---|
175 | <command> CXX="/usr/bin/g++" ./configure ...</command>: Avoid an annoying
|
---|
176 | message during configuration.
|
---|
177 | </para>
|
---|
178 |
|
---|
179 | <para>
|
---|
180 | <parameter>--with-system-expat</parameter>: This switch enables linking
|
---|
181 | against the system version of <application>Expat</application>.
|
---|
182 | </para>
|
---|
183 |
|
---|
184 | <para>
|
---|
185 | <parameter>--with-system-ffi</parameter>: This switch enables linking
|
---|
186 | against the system version of <application>libffi</application>.
|
---|
187 | </para>
|
---|
188 | <!--
|
---|
189 | <para>
|
---|
190 | <parameter>- -with-ensurepip=yes</parameter> : This switch enables building
|
---|
191 | the <command>pip</command> and <command>setuptools</command> packaging
|
---|
192 | programs. <command>setuptools</command> is needed for building some
|
---|
193 | Python modules.
|
---|
194 | </para>
|
---|
195 | -->
|
---|
196 | <para>
|
---|
197 | <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
|
---|
198 | if you want to build the <application>Python</application> DBM Module
|
---|
199 | against <application>Berkeley DB</application> instead of
|
---|
200 | <application>GDBM</application>.
|
---|
201 | </para>
|
---|
202 |
|
---|
203 | <para>
|
---|
204 | <parameter>--enable-optimizations</parameter>: This switch enables
|
---|
205 | stable, but expensive, optimizations.
|
---|
206 | </para>
|
---|
207 |
|
---|
208 | <para>
|
---|
209 | <option>--with-lto</option>: This optional switch enables thick Link
|
---|
210 | Time Optimization. Unusually, it creates a much larger <filename
|
---|
211 | class="libraryfile">/usr/lib/python&python3-majorver;/config-&python3-majorver;-<arch>-linux-gnu/libpython&python3-majorver;.a</filename>
|
---|
212 | with a small increase in the time to compile
|
---|
213 | <application>Python</application>. Run-time results do not appear to show
|
---|
214 | any benefit from doing this.
|
---|
215 | </para>
|
---|
216 |
|
---|
217 | </sect2>
|
---|
218 |
|
---|
219 | <sect2 role="configuration">
|
---|
220 | <title>Configuring Python 3</title>
|
---|
221 |
|
---|
222 | <para>
|
---|
223 | In order for <command>python3</command> to find the installed
|
---|
224 | documentation, create the following version independent symlink:
|
---|
225 | </para>
|
---|
226 |
|
---|
227 | <screen role="root"><userinput>ln -svfn python-&python3-version; /usr/share/doc/python-3</userinput></screen>
|
---|
228 |
|
---|
229 | <para>
|
---|
230 | and add the following environment variable to the individual user's or
|
---|
231 | system's profile:
|
---|
232 | </para>
|
---|
233 |
|
---|
234 | <screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-3/html</userinput></screen>
|
---|
235 |
|
---|
236 | </sect2>
|
---|
237 |
|
---|
238 | <sect2 role="content">
|
---|
239 | <title>Contents</title>
|
---|
240 |
|
---|
241 | <segmentedlist>
|
---|
242 | <segtitle>Installed Programs</segtitle>
|
---|
243 | <segtitle>Installed Libraries</segtitle>
|
---|
244 | <segtitle>Installed Directories</segtitle>
|
---|
245 |
|
---|
246 | <seglistitem>
|
---|
247 | <seg>
|
---|
248 | 2to3 (symlink) and
|
---|
249 | 2to3-&python3-majorver;,
|
---|
250 |
|
---|
251 | <!--
|
---|
252 | easy_install-&python3-majorver;,
|
---|
253 | -->
|
---|
254 |
|
---|
255 | idle3 (symlink) and
|
---|
256 | idle&python3-majorver;,
|
---|
257 |
|
---|
258 | pip3 (symlink) and
|
---|
259 | pip&python3-majorver;,
|
---|
260 |
|
---|
261 | pydoc3 and
|
---|
262 | pydoc&python3-majorver;,
|
---|
263 |
|
---|
264 | python3 (symlink);
|
---|
265 | python&python3-majorver;, and
|
---|
266 |
|
---|
267 | python3-config (symlink) and
|
---|
268 | python&python3-majorver;-config
|
---|
269 | </seg>
|
---|
270 | <seg>
|
---|
271 | libpython&python3-majorver;.so and libpython3.so
|
---|
272 | </seg>
|
---|
273 | <seg>
|
---|
274 | /usr/include/python&python3-majorver;,
|
---|
275 | /usr/lib/python&python3-majorver;, and
|
---|
276 | /usr/share/doc/python-&python3-version;
|
---|
277 | </seg>
|
---|
278 | </seglistitem>
|
---|
279 | </segmentedlist>
|
---|
280 |
|
---|
281 | <variablelist>
|
---|
282 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
283 | <?dbfo list-presentation="list"?>
|
---|
284 | <?dbhtml list-presentation="table"?>
|
---|
285 | <!--
|
---|
286 | <varlistentry id="2to3">
|
---|
287 | <term><command>2to3</command></term>
|
---|
288 | <listitem>
|
---|
289 | <para>
|
---|
290 | is designed to assist in the transition between python2 and python3
|
---|
291 | by automatically converting code to be Python3 compatible.
|
---|
292 | </para>
|
---|
293 | <indexterm zone="python3 2to3">
|
---|
294 | <primary sortas="b-2to3">2to3</primary>
|
---|
295 | </indexterm>
|
---|
296 | </listitem>
|
---|
297 | </varlistentry>
|
---|
298 | Put here for easy use when removing Python2 -->
|
---|
299 | <!--
|
---|
300 | <varlistentry id="easy_install">
|
---|
301 | <term><command>easy_install</command></term>
|
---|
302 | <listitem>
|
---|
303 | <para>
|
---|
304 | is a frontend to pip3 to make it easier to configure python modules
|
---|
305 | through the PIP package manager
|
---|
306 | </para>
|
---|
307 | <indexterm zone="python3 easy_install">
|
---|
308 | <primary sortas="python3 easy_install">easy_install</primary>
|
---|
309 | </indexterm>
|
---|
310 | </listitem>
|
---|
311 | </varlistentry>
|
---|
312 | -->
|
---|
313 | <varlistentry id="idle3">
|
---|
314 | <term><command>idle3</command></term>
|
---|
315 | <listitem>
|
---|
316 | <para>
|
---|
317 | is a wrapper script that opens a <application>Python</application>
|
---|
318 | aware GUI editor. For this script to run, you must have installed
|
---|
319 | <application>Tk</application> before Python so that the Tkinter
|
---|
320 | Python module is built
|
---|
321 | </para>
|
---|
322 | <indexterm zone="python3 idle3">
|
---|
323 | <primary sortas="b-idle3">idle3</primary>
|
---|
324 | </indexterm>
|
---|
325 | </listitem>
|
---|
326 | </varlistentry>
|
---|
327 |
|
---|
328 | <varlistentry id="pydoc3">
|
---|
329 | <term><command>pydoc3</command></term>
|
---|
330 | <listitem>
|
---|
331 | <para>
|
---|
332 | is the <application>Python</application> documentation
|
---|
333 | tool
|
---|
334 | </para>
|
---|
335 | <indexterm zone="python3 pydoc3">
|
---|
336 | <primary sortas="b-pydoc3">pydo3c</primary>
|
---|
337 | </indexterm>
|
---|
338 | </listitem>
|
---|
339 | </varlistentry>
|
---|
340 |
|
---|
341 | <varlistentry id="python3-prog">
|
---|
342 | <term><command>python3</command></term>
|
---|
343 | <listitem>
|
---|
344 | <para>
|
---|
345 | is an interpreted, interactive, object-oriented programming
|
---|
346 | language
|
---|
347 | </para>
|
---|
348 | <indexterm zone="python3 python3-prog">
|
---|
349 | <primary sortas="b-python3">python3</primary>
|
---|
350 | </indexterm>
|
---|
351 | </listitem>
|
---|
352 | </varlistentry>
|
---|
353 |
|
---|
354 | <varlistentry id="python-ver">
|
---|
355 | <term><command>python&python3-majorver;</command></term>
|
---|
356 | <listitem>
|
---|
357 | <para>
|
---|
358 | is a version-specific name for the <command>python</command>
|
---|
359 | program
|
---|
360 | </para>
|
---|
361 | <indexterm zone="python3 python-ver">
|
---|
362 | <primary sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
|
---|
363 | </indexterm>
|
---|
364 | </listitem>
|
---|
365 | </varlistentry>
|
---|
366 | <!--
|
---|
367 | <varlistentry id="pyvenv">
|
---|
368 | <term><command>pyvenv</command></term>
|
---|
369 | <listitem>
|
---|
370 | <para>
|
---|
371 | creates virtual <application>Python</application> environments in
|
---|
372 | one or more target directories.
|
---|
373 | </para>
|
---|
374 | <indexterm zone="python3 pyvenv">
|
---|
375 | <primary
|
---|
376 | sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
|
---|
377 | </indexterm>
|
---|
378 | </listitem>
|
---|
379 | </varlistentry>
|
---|
380 | -->
|
---|
381 | </variablelist>
|
---|
382 |
|
---|
383 | </sect2>
|
---|
384 |
|
---|
385 | </sect1>
|
---|