source: general/prog/python3.xml@ 7420ff72

12.1 ken/TL2024 ken/tuningfonts lazarus plabs/newcss python3.11 rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18
Last change on this file since 7420ff72 was 7420ff72, checked in by Bruce Dubbs <bdubbs@…>, 7 months ago

Update to Python-3.12.0.

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