source: general/prog/python3.xml@ 456a96b

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 9.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 456a96b was d10196e0, checked in by Douglas R. Reno <renodr@…>, 4 years ago

Revert my python3 change from yesterday.

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

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