source: general/prog/python3.xml@ 83f8954

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 83f8954 was de33b2a, checked in by Pierre Labastie <pieere@…>, 4 years ago

Format general/prog

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@22835 af4574ff-66df-0310-9fd7-8a98e5e911e0

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