source: general/prog/python3.xml@ 86b4e0ee

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 86b4e0ee was 86b4e0ee, checked in by Bruce Dubbs <bdubbs@…>, 3 years ago

Update to Python-3.9.2.

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

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