source: general/prog/python3.xml@ 693f28e1

10.0 10.1 11.0 ken/refactor-virt lazarus qt5new trunk upgradedb xry111/git-date xry111/git-date-for-trunk xry111/git-date-test
Last change on this file since 693f28e1 was 693f28e1, checked in by Ken Moffat <ken@…>, 17 months ago

Firefox-78 requires python3 to be rebuilt in BLFS after installing sqlite3. Also comment rust from thunderbird deps since cbindgen pulls it in.

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

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