source: general/prog/python3.xml@ 3d349f4

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 3d349f4 was 4ca6236, checked in by Xi Ruoyao <xry111@…>, 8 months ago

python3: Remove stale explanation for --with-system-ffi

  • Property mode set to 100644
File size: 13.5 KB
RevLine 
[52d29f7]1<?xml version="1.0" encoding="ISO-8859-1"?>
[6732c094]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
[52d29f7]4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
[2cee003]7 <!ENTITY python3-download-http
[3f89ec5]8 "https://www.python.org/ftp/python/&python3-version;/Python-&python3-version;.tar.xz">
[355495ce]9 <!ENTITY python3-download-ftp " ">
[7420ff72]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)">
[e882fc37]14 <!--
[deaa200]15 Note: Size does not reflect docs that were installed in LFS.
[3df4c93]16 -->
[2cee003]17 <!ENTITY python3htmldoc-download-http
[1fe05eb]18 "https://www.python.org/ftp/python/doc/&python3-version;/python-&python3-version;-docs-html.tar.bz2">
[deaa200]19 <!ENTITY python3-docs-md5sum "1abed52338038f4b53a277a5558af838" >
[52d29f7]20]>
21
[b88be39]22<sect1 id="python3" xreflabel="Python-&python3-version;">
23 <?dbhtml filename="python3.html" ?>
[83f69e5d]24
25
[b88be39]26 <title>Python-&python3-version;</title>
[83f69e5d]27
[b88be39]28 <indexterm zone="python3">
[03d30cf]29 <primary sortas="a-Python3">Python3</primary>
[83f69e5d]30 </indexterm>
31
32 <sect2 role="package">
[03d30cf]33 <title>Introduction to Python 3</title>
[83f69e5d]34
[355495ce]35 <para>
[03d30cf]36 The <application>Python 3</application> package contains the
[355495ce]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>
[48b816cb]41
[de33b2a]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
[b9a6bcc0]46 are needed, or to upgrade this package.
[de33b2a]47 </para>
48 </note>
[60ddbaf]49
[a73fc762]50 &lfs120_checked;
[48b816cb]51
[bd68243]52 <important>
53 <para>
54 If upgrading to a new Python-3 minor version (for example,
[7420ff72]55 from Python-3.11.x to Python-3.12.0), you will need to reinstall
[bd68243]56 any Python3 modules you have installed. You should also
57 reinstall packages that generate Python3 modules
[54d58907]58 including
[ea3ad858]59 <xref linkend="gobject-introspection"/>,
[bd68243]60 <xref linkend="opencv"/>,
[bf09c25]61 <xref linkend="graphviz"/> (if swig is installed).
62 </para>
63
[fb0bbe2]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.
[bd68243]71 </para>
[ec288f7]72
73 <para>
[fb0bbe2]74 The Python modules from LFS will also have to be reinstalled:
75 <ulink url="&lfs-root;/chapter08/flit-core.html">flit-core</ulink>,
[32c1b77]76 <ulink url="&lfs-root;/chapter08/wheel.html">wheel</ulink>,
[7420ff72]77 <ulink url="&lfs-root;/chapter08/setuptools.html">setuptools</ulink>,
[32c1b77]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>.
[ec288f7]81 </para>
[bd68243]82 </important>
83
[83f69e5d]84 <bridgehead renderas="sect3">Package Information</bridgehead>
85 <itemizedlist spacing="compact">
86 <listitem>
[355495ce]87 <para>
88 Download (HTTP): <ulink url="&python3-download-http;"/>
89 </para>
[83f69e5d]90 </listitem>
91 <listitem>
[355495ce]92 <para>
93 Download (FTP): <ulink url="&python3-download-ftp;"/>
94 </para>
[83f69e5d]95 </listitem>
96 <listitem>
[355495ce]97 <para>
98 Download MD5 sum: &python3-md5sum;
99 </para>
[83f69e5d]100 </listitem>
101 <listitem>
[355495ce]102 <para>
103 Download size: &python3-size;
104 </para>
[83f69e5d]105 </listitem>
106 <listitem>
[355495ce]107 <para>
108 Estimated disk space required: &python3-buildsize;
109 </para>
[83f69e5d]110 </listitem>
111 <listitem>
[355495ce]112 <para>
113 Estimated build time: &python3-time;
114 </para>
[83f69e5d]115 </listitem>
116 </itemizedlist>
[e882fc37]117
[3df4c93]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
[03d30cf]132 <bridgehead renderas="sect3">Python 3 Dependencies</bridgehead>
[e882fc37]133
[693f28e1]134 <bridgehead renderas="sect4">Recommended</bridgehead>
135 <para role="recommended">
[a82b5f44]136 <xref linkend="sqlite"/> (required if building firefox or thunderbird)
[693f28e1]137 </para>
138
[83f69e5d]139 <bridgehead renderas="sect4">Optional</bridgehead>
[355495ce]140 <para role="optional">
[7fe0ce3b]141 <xref linkend="bluez"/>,
[e882fc37]142 <xref linkend="gdb"/> (required for some tests),
143 <xref linkend="valgrind"/>, and
[4e207bb]144 <ulink url="https://www.bytereef.org/mpdecimal/">libmpdec</ulink>
[355495ce]145 </para>
146
147 <bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
148 <para role="optional">
[9464475]149 <xref linkend="db"/>,
150 <xref linkend="libnsl"/>, and
[6030130]151 <xref linkend="tk"/>
[355495ce]152 </para>
[ce33273]153
[42ddc30]154 <para condition="html" role="usernotes">Editor Notes:
[355495ce]155 <ulink url="&blfs-wiki;/Python3"/>
156 </para>
[83f69e5d]157 </sect2>
158
159 <sect2 role="installation">
[03d30cf]160 <title>Installation of Python 3</title>
[83f69e5d]161
[355495ce]162 <para>
[03d30cf]163 Install <application>Python 3</application> by running the following
[355495ce]164 commands:
165 </para>
[83f69e5d]166
[a87fb41]167<screen><userinput>CXX="/usr/bin/g++" \
168./configure --prefix=/usr \
169 --enable-shared \
170 --with-system-expat \
171 --enable-optimizations &amp;&amp;
[83f69e5d]172make</userinput></screen>
173
[355495ce]174 <para>
[382d0115]175 <!-- I'm getting a test failure with empty $LANG:
176 "test test_curses failed"
177 "_curses.error: inswstr() returned ERR"
[7420ff72]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 -->
[382d0115]184 To test the result, issue <command>LC_ALL=en_US.UTF-8
185 make test</command>.
[7420ff72]186 Some tests may need an Internet connection.
[355495ce]187 </para>
188
189 <para>
190 Now, as the <systemitem class="username">root</systemitem> user:
191 </para>
192
[3df4c93]193<screen role="root"><userinput>make install</userinput></screen>
194
195 <para>
[1fe05eb]196 If upgrading and the documentation has been downloaded, optionally install
[3df4c93]197 it as the &root; user:
198 </para>
199
[4be7bcd]200<screen role="root"><userinput>install -v -dm755 /usr/share/doc/python-&python3-version;/html
201
202tar --strip-components=1 \
[3df4c93]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>
[1970f00]207
[879d269]208 </sect2>
209
210 <sect2 role="commands">
211 <title>Command Explanations</title>
212
[fd69a62]213 <para>
214 <command> CXX="/usr/bin/g++" ./configure ...</command>: Avoid an annoying
215 message during configuration.
216 </para>
217
[355495ce]218 <para>
[f1d7196]219 <parameter>--with-system-expat</parameter>: This switch enables linking
220 against the system version of <application>Expat</application>.
[355495ce]221 </para>
222
[988edbf5]223<!--
[fd69a62]224 <para>
[6e94284]225 <parameter>- -with-ensurepip=yes</parameter> : This switch enables building
[8558044]226 the <command>pip</command> and <command>setuptools</command> packaging
[229d069]227 programs. <command>setuptools</command> is needed for building some
228 Python modules.
[fd69a62]229 </para>
[988edbf5]230-->
[f1d7196]231 <para>
232 <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
[229d069]233 if you want to build the <application>Python</application> DBM Module
[f1d7196]234 against <application>Berkeley DB</application> instead of
235 <application>GDBM</application>.
236 </para>
237
[7c57f82]238 <para>
[a0bb9145]239 <parameter>--enable-optimizations</parameter>: This switch enables
[a87fb41]240 stable, but expensive, optimizations.
[7c57f82]241 </para>
242
243 <para>
244 <option>--with-lto</option>: This optional switch enables thick Link
245 Time Optimization. Unusually, it creates a much larger <filename
[4e207bb]246 class="libraryfile">/usr/lib/python&python3-majorver;/config-&python3-majorver;-&lt;arch&gt;-linux-gnu/libpython&python3-majorver;.a</filename>
[7c57f82]247 with a small increase in the time to compile
248 <application>Python</application>. Run-time results do not appear to show
249 any benefit from doing this.
250 </para>
[7224506]251
[879d269]252 </sect2>
253
254 <sect2 role="configuration">
[03d30cf]255 <title>Configuring Python 3</title>
[879d269]256
[355495ce]257 <para>
[03d30cf]258 In order for <command>python3</command> to find the installed
[d7015e7]259 documentation, create the following version independent symlink:
[355495ce]260 </para>
[1970f00]261
[d7015e7]262<screen role="root"><userinput>ln -svfn python-&python3-version; /usr/share/doc/python-3</userinput></screen>
263
264 <para>
265 and add the following environment variable to the individual user's or
266 system's profile:
267 </para>
268
269<screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-3/html</userinput></screen>
[83f69e5d]270
271 </sect2>
272
273 <sect2 role="content">
274 <title>Contents</title>
275
276 <segmentedlist>
277 <segtitle>Installed Programs</segtitle>
278 <segtitle>Installed Libraries</segtitle>
279 <segtitle>Installed Directories</segtitle>
280
281 <seglistitem>
[355495ce]282 <seg>
[f2ff0e4]283 2to3 (symlink) and
[355495ce]284 2to3-&python3-majorver;,
285
[229d069]286 <!--
[f2ff0e4]287 easy_install-&python3-majorver;,
[229d069]288 -->
[f2ff0e4]289
290 idle3 (symlink) and
291 idle&python3-majorver;,
[f5c5306]292
[deaa200]293 pip3 and
[f2ff0e4]294 pip&python3-majorver;,
295
[deaa200]296 pydoc3 (symlink) and
[355495ce]297 pydoc&python3-majorver;,
298
[deaa200]299 python3 (symlink) and
[f2ff0e4]300 python&python3-majorver;, and
[355495ce]301
[f2ff0e4]302 python3-config (symlink) and
303 python&python3-majorver;-config
[355495ce]304 </seg>
305 <seg>
[9e91b25]306 libpython&python3-majorver;.so and libpython3.so
[355495ce]307 </seg>
308 <seg>
[9e91b25]309 /usr/include/python&python3-majorver;,
[355495ce]310 /usr/lib/python&python3-majorver;, and
311 /usr/share/doc/python-&python3-version;
312 </seg>
[83f69e5d]313 </seglistitem>
314 </segmentedlist>
315
316 <variablelist>
317 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
318 <?dbfo list-presentation="list"?>
319 <?dbhtml list-presentation="table"?>
[f2ff0e4]320 <!--
321 <varlistentry id="2to3">
322 <term><command>2to3</command></term>
323 <listitem>
324 <para>
325 is designed to assist in the transition between python2 and python3
326 by automatically converting code to be Python3 compatible.
327 </para>
328 <indexterm zone="python3 2to3">
329 <primary sortas="b-2to3">2to3</primary>
330 </indexterm>
331 </listitem>
332 </varlistentry>
333 Put here for easy use when removing Python2 -->
[229d069]334 <!--
[f2ff0e4]335 <varlistentry id="easy_install">
336 <term><command>easy_install</command></term>
337 <listitem>
338 <para>
339 is a frontend to pip3 to make it easier to configure python modules
[4c24eb0a]340 through the PIP package manager
[f2ff0e4]341 </para>
342 <indexterm zone="python3 easy_install">
343 <primary sortas="python3 easy_install">easy_install</primary>
344 </indexterm>
345 </listitem>
346 </varlistentry>
[229d069]347 -->
[355495ce]348 <varlistentry id="idle3">
349 <term><command>idle3</command></term>
[83f69e5d]350 <listitem>
[355495ce]351 <para>
[d0aecd33]352 is a wrapper script that opens a <application>Python</application>
353 aware GUI editor. For this script to run, you must have installed
354 <application>Tk</application> before Python so that the Tkinter
[4c24eb0a]355 Python module is built
[355495ce]356 </para>
357 <indexterm zone="python3 idle3">
358 <primary sortas="b-idle3">idle3</primary>
[83f69e5d]359 </indexterm>
360 </listitem>
361 </varlistentry>
362
[355495ce]363 <varlistentry id="pydoc3">
364 <term><command>pydoc3</command></term>
[83f69e5d]365 <listitem>
[355495ce]366 <para>
367 is the <application>Python</application> documentation
[4c24eb0a]368 tool
[355495ce]369 </para>
370 <indexterm zone="python3 pydoc3">
371 <primary sortas="b-pydoc3">pydo3c</primary>
[83f69e5d]372 </indexterm>
373 </listitem>
374 </varlistentry>
375
[b88be39]376 <varlistentry id="python3-prog">
[2cee003]377 <term><command>python3</command></term>
[83f69e5d]378 <listitem>
[355495ce]379 <para>
380 is an interpreted, interactive, object-oriented programming
[4c24eb0a]381 language
[355495ce]382 </para>
[b88be39]383 <indexterm zone="python3 python3-prog">
384 <primary sortas="b-python3">python3</primary>
[83f69e5d]385 </indexterm>
386 </listitem>
387 </varlistentry>
388
[f67f5387]389 <varlistentry id="python-ver">
[b88be39]390 <term><command>python&python3-majorver;</command></term>
[83f69e5d]391 <listitem>
[355495ce]392 <para>
393 is a version-specific name for the <command>python</command>
[4c24eb0a]394 program
[355495ce]395 </para>
[b88be39]396 <indexterm zone="python3 python-ver">
[4c24eb0a]397 <primary sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
[83f69e5d]398 </indexterm>
399 </listitem>
400 </varlistentry>
[f2ff0e4]401 <!--
[21e8edc]402 <varlistentry id="pyvenv">
403 <term><command>pyvenv</command></term>
404 <listitem>
405 <para>
406 creates virtual <application>Python</application> environments in
407 one or more target directories.
408 </para>
409 <indexterm zone="python3 pyvenv">
410 <primary
411 sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
412 </indexterm>
413 </listitem>
414 </varlistentry>
[f2ff0e4]415 -->
[83f69e5d]416 </variablelist>
417
418 </sect2>
[f45b1953]419
420</sect1>
Note: See TracBrowser for help on using the repository browser.