source: general/prog/python3.xml

trunk
Last change on this file was 5895a37, checked in by Bruce Dubbs <bdubbs@…>, 10 days ago

Update blfs bootscripts version and fix an md5sum.

  • Property mode set to 100644
File size: 14.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
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 "8defb33f0c37aa4bdd3a38ba52abde4e">
11 <!ENTITY python3-size "20 MB">
12 <!ENTITY python3-buildsize "335 MB (add 57 MB for tests)">
13 <!ENTITY python3-time "2.2 SBU (add 1.0 SBU for tests; both using parallelism=4)">
14 <!--
15 Note: Size does not reflect docs that were installed 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 "6025ee63c0ded34aac874f5da8f1a90c" >
20]>
21
22<sect1 id="python3" xreflabel="Python-&python3-version;">
23 <?dbhtml filename="python3.html" ?>
24
25
26 <title>Python-&python3-version;</title>
27
28 <indexterm zone="python3">
29 <primary sortas="a-Python3">Python3</primary>
30 </indexterm>
31
32 <sect2 role="package">
33 <title>Introduction to Python 3</title>
34
35 <para>
36 The <application>Python 3</application> package contains the
37 <application>Python</application> development environment.
38 This is useful for object-oriented programming, writing scripts,
39 prototyping large programs or developing entire applications.
40 </para>
41
42 <note>
43 <para>
44 <application>Python 3</application> was installed in LFS.
45 The only reason to rebuild it here is if optional modules
46 are needed, or to upgrade this package.
47 </para>
48 </note>
49
50 &lfs121_checked;
51
52 <important>
53 <para>
54 If upgrading to a new Python-3 minor version (for example,
55 from Python-3.11.x to Python-3.12.0), you will need to reinstall
56 any Python3 modules you have installed. You should also
57 reinstall packages that generate Python3 modules
58 including
59 &gobject-introspection;,
60 <xref linkend="libxml2"/>,
61 <xref linkend="opencv"/>,
62 <xref linkend="fontforge"/>,
63 <xref linkend="gnome-tweaks"/>,
64 <xref linkend="samba"/>, and
65 <xref linkend="graphviz"/> (if swig is installed).
66 </para>
67
68 <para>Before you upgrade, you can get a list of modules installed
69 with <command>pip3 list</command>. The list may be incomplete as
70 some Python modules are not installed with <command>pip3</command>,
71 for example the <literal>cracklib</literal> module installed by
72 <xref role='nodep' linkend='cracklib'/>. Use <command>ls
73 /usr/lib/python3.<replaceable>minor</replaceable>/site-packages</command>
74 for a comprehensive list.
75 </para>
76
77 <para>
78 The Python modules from LFS will also have to be reinstalled:
79 <ulink url="&lfs-root;/chapter08/flit-core.html">flit-core</ulink>,
80 <ulink url="&lfs-root;/chapter08/wheel.html">wheel</ulink>,
81 <ulink url="&lfs-root;/chapter08/setuptools.html">setuptools</ulink>,
82 <ulink url="&lfs-root;/chapter08/meson.html">meson</ulink>,
83 <ulink url="&lfs-root;/chapter08/markupsafe.html">MarkupSafe</ulink>,
84 and <ulink url="&lfs-root;/chapter08/jinja2.html">Jinja2</ulink>.
85 </para>
86 </important>
87
88 <bridgehead renderas="sect3">Package Information</bridgehead>
89 <itemizedlist spacing="compact">
90 <listitem>
91 <para>
92 Download (HTTP): <ulink url="&python3-download-http;"/>
93 </para>
94 </listitem>
95 <listitem>
96 <para>
97 Download (FTP): <ulink url="&python3-download-ftp;"/>
98 </para>
99 </listitem>
100 <listitem>
101 <para>
102 Download MD5 sum: &python3-md5sum;
103 </para>
104 </listitem>
105 <listitem>
106 <para>
107 Download size: &python3-size;
108 </para>
109 </listitem>
110 <listitem>
111 <para>
112 Estimated disk space required: &python3-buildsize;
113 </para>
114 </listitem>
115 <listitem>
116 <para>
117 Estimated build time: &python3-time;
118 </para>
119 </listitem>
120 </itemizedlist>
121
122 <bridgehead renderas="sect3">Additional Optional Download</bridgehead>
123 <itemizedlist spacing="compact">
124 <listitem>
125 <para>
126 Download (HTTP): <ulink url="&python3htmldoc-download-http;"/>
127 </para>
128 </listitem>
129 <listitem>
130 <para>
131 Download MD5 sum: &python3-docs-md5sum;
132 </para>
133 </listitem>
134 </itemizedlist>
135
136 <bridgehead renderas="sect3">Python 3 Dependencies</bridgehead>
137
138 <bridgehead renderas="sect4">Recommended</bridgehead>
139 <para role="recommended">
140 <xref linkend="sqlite"/> (required if building firefox or thunderbird)
141 </para>
142
143 <bridgehead renderas="sect4">Optional</bridgehead>
144 <para role="optional">
145 <xref linkend="bluez"/>,
146 <xref linkend="gdb"/> (required for some tests),
147 <xref linkend="valgrind"/>, and
148 <ulink url="https://www.bytereef.org/mpdecimal/">libmpdec</ulink>
149 </para>
150
151 <bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
152 <para role="optional">
153 <xref linkend="libnsl"/>,
154 <xref linkend="tk"/>, and
155 &berkeley-db;
156 </para>
157
158 <para condition="html" role="usernotes">Editor Notes:
159 <ulink url="&blfs-wiki;/Python3"/>
160 </para>
161 </sect2>
162
163 <sect2 role="installation">
164 <title>Installation of Python 3</title>
165
166 <para>
167 Install <application>Python 3</application> by running the following
168 commands:
169 </para>
170
171<screen><userinput>CXX="/usr/bin/g++" \
172./configure --prefix=/usr \
173 --enable-shared \
174 --with-system-expat \
175 --enable-optimizations &amp;&amp;
176make</userinput></screen>
177
178 <para>
179 <!-- I'm getting a test failure with empty $LANG:
180 "test test_curses failed"
181 "_curses.error: inswstr() returned ERR"
182 not sure why, but let's just work around it with LC_ALL.
183
184 For Python-3.12.0 all tests pass with only LANG=en_US.utf8.
185 Total tests: run=41,505 skipped=1,199
186 Total test files: run=477/483 skipped=12 resource_denied=6
187
188 For Python-3.12.1 all tests pass
189 Total tests: run=40,624 skipped=1,136
190 Total test files: run=486/489 skipped=24 resource_denied=3
191
192 For Python-3.12.2 all tests pass
193 Total tests: run=41,580 skipped=1,144
194 Total test files: run=485/488 skipped=23 resource_denied=3
195
196 For Python-3.12.3 all tests pass
197 Total tests: run=41,778 skipped=1,155
198 Total test files: run=485/488 skipped=24 resource_denied=3
199 -->
200 To test the result, issue <command>LC_ALL=en_US.UTF-8
201 make test</command>.
202 Some tests may need an Internet connection.
203 </para>
204
205 <para>
206 Now, as the <systemitem class="username">root</systemitem> user:
207 </para>
208
209<screen role="root"><userinput>make install</userinput></screen>
210
211 <para>
212 If upgrading and the documentation has been downloaded, optionally install
213 it as the &root; user:
214 </para>
215
216<screen role="root"><userinput>install -v -dm755 /usr/share/doc/python-&python3-version;/html
217
218tar --strip-components=1 \
219 --no-same-owner \
220 --no-same-permissions \
221 -C /usr/share/doc/python-&python3-version;/html \
222 -xvf ../python-&python3-version;-docs-html.tar.bz2</userinput></screen>
223
224 </sect2>
225
226 <sect2 role="commands">
227 <title>Command Explanations</title>
228
229 <para>
230 <command> CXX="/usr/bin/g++" ./configure ...</command>: Avoid an annoying
231 message during configuration.
232 </para>
233
234 <para>
235 <parameter>--with-system-expat</parameter>: This switch enables linking
236 against the system version of <application>Expat</application>.
237 </para>
238
239<!--
240 <para>
241 <parameter>- -with-ensurepip=yes</parameter> : This switch enables building
242 the <command>pip</command> and <command>setuptools</command> packaging
243 programs. <command>setuptools</command> is needed for building some
244 Python modules.
245 </para>
246-->
247 <para>
248 <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
249 if you want to build the <application>Python</application> DBM Module
250 against <application>Berkeley DB</application> instead of
251 <application>GDBM</application>.
252 </para>
253
254 <para>
255 <parameter>--enable-optimizations</parameter>: This switch enables
256 stable, but expensive, optimizations.
257 </para>
258
259 <para>
260 <option>--with-lto</option>: This optional switch enables thick Link
261 Time Optimization. Unusually, it creates a much larger <filename
262 class="libraryfile">/usr/lib/python&python3-majorver;/config-&python3-majorver;-&lt;arch&gt;-linux-gnu/libpython&python3-majorver;.a</filename>
263 with a small increase in the time to compile
264 <application>Python</application>. Run-time results do not appear to show
265 any benefit from doing this.
266 </para>
267
268 </sect2>
269
270 <sect2 role="configuration">
271 <title>Configuring Python 3</title>
272
273 <para>
274 In order for <command>python3</command> to find the installed
275 documentation, create the following version independent symlink:
276 </para>
277
278<screen role="root"><userinput>ln -svfn python-&python3-version; /usr/share/doc/python-3</userinput></screen>
279
280 <para>
281 and add the following environment variable to the individual user's or
282 system's profile:
283 </para>
284
285<screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-3/html</userinput></screen>
286
287 </sect2>
288
289 <sect2 role="content">
290 <title>Contents</title>
291
292 <segmentedlist>
293 <segtitle>Installed Programs</segtitle>
294 <segtitle>Installed Libraries</segtitle>
295 <segtitle>Installed Directories</segtitle>
296
297 <seglistitem>
298 <seg>
299 2to3 (symlink) and
300 2to3-&python3-majorver;,
301
302 <!--
303 easy_install-&python3-majorver;,
304 -->
305
306 idle3 (symlink) and
307 idle&python3-majorver;,
308
309 pip3 and
310 pip&python3-majorver;,
311
312 pydoc3 (symlink) and
313 pydoc&python3-majorver;,
314
315 python3 (symlink) and
316 python&python3-majorver;, and
317
318 python3-config (symlink) and
319 python&python3-majorver;-config
320 </seg>
321 <seg>
322 libpython&python3-majorver;.so and libpython3.so
323 </seg>
324 <seg>
325 /usr/include/python&python3-majorver;,
326 /usr/lib/python&python3-majorver;, and
327 /usr/share/doc/python-&python3-version;
328 </seg>
329 </seglistitem>
330 </segmentedlist>
331
332 <variablelist>
333 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
334 <?dbfo list-presentation="list"?>
335 <?dbhtml list-presentation="table"?>
336 <!--
337 <varlistentry id="2to3">
338 <term><command>2to3</command></term>
339 <listitem>
340 <para>
341 is designed to assist in the transition between python2 and python3
342 by automatically converting code to be Python3 compatible.
343 </para>
344 <indexterm zone="python3 2to3">
345 <primary sortas="b-2to3">2to3</primary>
346 </indexterm>
347 </listitem>
348 </varlistentry>
349 Put here for easy use when removing Python2 -->
350 <!--
351 <varlistentry id="easy_install">
352 <term><command>easy_install</command></term>
353 <listitem>
354 <para>
355 is a frontend to pip3 to make it easier to configure python modules
356 through the PIP package manager
357 </para>
358 <indexterm zone="python3 easy_install">
359 <primary sortas="python3 easy_install">easy_install</primary>
360 </indexterm>
361 </listitem>
362 </varlistentry>
363 -->
364 <varlistentry id="idle3">
365 <term><command>idle3</command></term>
366 <listitem>
367 <para>
368 is a wrapper script that opens a <application>Python</application>
369 aware GUI editor. For this script to run, you must have installed
370 <application>Tk</application> before Python so that the Tkinter
371 Python module is built
372 </para>
373 <indexterm zone="python3 idle3">
374 <primary sortas="b-idle3">idle3</primary>
375 </indexterm>
376 </listitem>
377 </varlistentry>
378
379 <varlistentry id="pydoc3">
380 <term><command>pydoc3</command></term>
381 <listitem>
382 <para>
383 is the <application>Python</application> documentation
384 tool
385 </para>
386 <indexterm zone="python3 pydoc3">
387 <primary sortas="b-pydoc3">pydo3c</primary>
388 </indexterm>
389 </listitem>
390 </varlistentry>
391
392 <varlistentry id="python3-prog">
393 <term><command>python3</command></term>
394 <listitem>
395 <para>
396 is an interpreted, interactive, object-oriented programming
397 language
398 </para>
399 <indexterm zone="python3 python3-prog">
400 <primary sortas="b-python3">python3</primary>
401 </indexterm>
402 </listitem>
403 </varlistentry>
404
405 <varlistentry id="python-ver">
406 <term><command>python&python3-majorver;</command></term>
407 <listitem>
408 <para>
409 is a version-specific name for the <command>python</command>
410 program
411 </para>
412 <indexterm zone="python3 python-ver">
413 <primary sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
414 </indexterm>
415 </listitem>
416 </varlistentry>
417 <!--
418 <varlistentry id="pyvenv">
419 <term><command>pyvenv</command></term>
420 <listitem>
421 <para>
422 creates virtual <application>Python</application> environments in
423 one or more target directories.
424 </para>
425 <indexterm zone="python3 pyvenv">
426 <primary
427 sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
428 </indexterm>
429 </listitem>
430 </varlistentry>
431 -->
432 </variablelist>
433
434 </sect2>
435
436</sect1>
Note: See TracBrowser for help on using the repository browser.