source: general/prog/python3.xml@ a73fc762

12.0 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 a73fc762 was a73fc762, checked in by Douglas R. Reno <renodr@…>, 9 months ago

Tags

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