source: general/prog/python3.xml@ 7b66ed2

11.0 ken/refactor-virt lazarus qt5new trunk xry111/git-date xry111/git-date-for-trunk xry111/git-date-test
Last change on this file since 7b66ed2 was 7b66ed2, checked in by Pierre Labastie <pieere@…>, 8 months ago

Fix a header file in python for certain use cases;
For usage of python3 for cracklib python bindings

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

  • Property mode set to 100644
File size: 11.6 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 &lfs101_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 Fix a header file, which is needed for some use cases:
120 </para>
121
122<screen><userinput>sed 's|cpython/||' -i Include/cpython/pystate.h</userinput></screen>
123
124 <para>
125 Install <application>Python 3</application> by running the following
126 commands:
127 </para>
128
129<screen><userinput>CXX="/usr/bin/g++" \
130./configure --prefix=/usr \
131 --enable-shared \
132 --with-system-expat \
133 --with-system-ffi \
134 --with-ensurepip=yes &amp;&amp;
135make</userinput></screen>
136
137 <para>
138 To test the result, issue <command>make test</command>.
139 Some tests may need Internet connection.
140 </para>
141
142 <para>
143 Now, as the <systemitem class="username">root</systemitem> user:
144 </para>
145
146<screen role="root"><userinput>make install</userinput></screen>
147
148 </sect2>
149
150 <sect2 role="commands">
151 <title>Command Explanations</title>
152
153 <para>
154 <command> CXX="/usr/bin/g++" ./configure ...</command>: Avoid an annoying
155 message during configuration.
156 </para>
157
158 <para>
159 <parameter>--with-system-expat</parameter>: This switch enables linking
160 against the system version of <application>Expat</application>.
161 </para>
162
163 <para>
164 <parameter>--with-system-ffi</parameter>: This switch enables linking
165 against system version of <application>libffi</application>.
166 </para>
167
168 <para>
169 <parameter>--with-ensurepip=yes</parameter> : This switch enables building
170 <command>pip</command> and <command>setuptools</command> packaging programs.
171 <command>setuptools</command> is needed for building some Python modules.
172 </para>
173
174 <para>
175 <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
176 if you want to build <application>Python</application> DBM Module
177 against <application>Berkeley DB</application> instead of
178 <application>GDBM</application>.
179 </para>
180
181 <para>
182 <option>--enable-optimization</option>: Use this switch
183 if you want to enable <emphasis>expensive</emphasis> optimizations (i.e.
184 Profile Guided Optimizations). This adds around 20 SBU, but can
185 <emphasis>slightly</emphasis> speed up some uses, such as using
186 <application>Sphinx</application> for creating documentation, or use of
187 <application>Python3</application> scripts.
188 </para>
189
190 <para>
191 <option>--with-lto</option>: This optional switch enables thick Link
192 Time Optimization. Unusually, it creates a much larger <filename
193 class="libraryfile">/usr/lib/python&python3-majorver;/config-&python3-majorver;-&lt;arch&gt;-linux-gnu/libpython&python3-majorver;.a</filename>
194 with a small increase in the time to compile
195 <application>Python</application>. Run-time results do not appear to show
196 any benefit from doing this.
197 </para>
198 <!--
199 <para>
200 <command>ln -sfv ...</command>: When upgrading to Python-3.8, it was
201 discovered that the symlink to pip3 is sometimes not created. Create
202 the symlink so that pip3 can be used as described in the book.
203 </para>
204 -->
205
206 </sect2>
207
208 <sect2 role="configuration">
209 <title>Configuring Python 3</title>
210
211 <para>
212 In order for <command>python3</command> to find the installed
213 documentation, create the following version independent symlink:
214 </para>
215
216<screen role="root"><userinput>ln -svfn python-&python3-version; /usr/share/doc/python-3</userinput></screen>
217
218 <para>
219 and add the following environment variable to the individual user's or
220 system's profile:
221 </para>
222
223<screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-3/html</userinput></screen>
224
225 </sect2>
226
227 <sect2 role="content">
228 <title>Contents</title>
229
230 <segmentedlist>
231 <segtitle>Installed Programs</segtitle>
232 <segtitle>Installed Libraries</segtitle>
233 <segtitle>Installed Directories</segtitle>
234
235 <seglistitem>
236 <seg>
237 2to3 (symlink) and
238 2to3-&python3-majorver;,
239
240 easy_install-&python3-majorver;,
241
242 idle3 (symlink) and
243 idle&python3-majorver;,
244
245 pip3 (symlink) and
246 pip&python3-majorver;,
247
248 pydoc3 and
249 pydoc&python3-majorver;,
250
251 python3 (symlink);
252 python&python3-majorver;, and
253
254 python3 (symlink), and
255 python&python3-majorver;
256
257 python3-config (symlink) and
258 python&python3-majorver;-config
259 </seg>
260 <seg>
261 libpython&python3-majorver;.so and libpython3.so
262 </seg>
263 <seg>
264 /usr/include/python&python3-majorver;,
265 /usr/lib/python&python3-majorver;, and
266 /usr/share/doc/python-&python3-version;
267 </seg>
268 </seglistitem>
269 </segmentedlist>
270
271 <variablelist>
272 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
273 <?dbfo list-presentation="list"?>
274 <?dbhtml list-presentation="table"?>
275 <!--
276 <varlistentry id="2to3">
277 <term><command>2to3</command></term>
278 <listitem>
279 <para>
280 is designed to assist in the transition between python2 and python3
281 by automatically converting code to be Python3 compatible.
282 </para>
283 <indexterm zone="python3 2to3">
284 <primary sortas="b-2to3">2to3</primary>
285 </indexterm>
286 </listitem>
287 </varlistentry>
288 Put here for easy use when removing Python2 -->
289 <varlistentry id="easy_install">
290 <term><command>easy_install</command></term>
291 <listitem>
292 <para>
293 is a frontend to pip3 to make it easier to configure python modules
294 through the PIP package manager
295 </para>
296 <indexterm zone="python3 easy_install">
297 <primary sortas="python3 easy_install">easy_install</primary>
298 </indexterm>
299 </listitem>
300 </varlistentry>
301
302 <varlistentry id="idle3">
303 <term><command>idle3</command></term>
304 <listitem>
305 <para>
306 is a wrapper script that opens a <application>Python</application>
307 aware GUI editor. For this script to run, you must have installed
308 <application>Tk</application> before Python so that the Tkinter
309 Python module is built
310 </para>
311 <indexterm zone="python3 idle3">
312 <primary sortas="b-idle3">idle3</primary>
313 </indexterm>
314 </listitem>
315 </varlistentry>
316
317 <varlistentry id="pydoc3">
318 <term><command>pydoc3</command></term>
319 <listitem>
320 <para>
321 is the <application>Python</application> documentation
322 tool
323 </para>
324 <indexterm zone="python3 pydoc3">
325 <primary sortas="b-pydoc3">pydo3c</primary>
326 </indexterm>
327 </listitem>
328 </varlistentry>
329
330 <varlistentry id="python3-prog">
331 <term><command>python3</command></term>
332 <listitem>
333 <para>
334 is an interpreted, interactive, object-oriented programming
335 language
336 </para>
337 <indexterm zone="python3 python3-prog">
338 <primary sortas="b-python3">python3</primary>
339 </indexterm>
340 </listitem>
341 </varlistentry>
342
343 <varlistentry id="python-ver">
344 <term><command>python&python3-majorver;</command></term>
345 <listitem>
346 <para>
347 is a version-specific name for the <command>python</command>
348 program
349 </para>
350 <indexterm zone="python3 python-ver">
351 <primary sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
352 </indexterm>
353 </listitem>
354 </varlistentry>
355 <!--
356 <varlistentry id="pyvenv">
357 <term><command>pyvenv</command></term>
358 <listitem>
359 <para>
360 creates virtual <application>Python</application> environments in
361 one or more target directories.
362 </para>
363 <indexterm zone="python3 pyvenv">
364 <primary
365 sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
366 </indexterm>
367 </listitem>
368 </varlistentry>
369 -->
370 </variablelist>
371
372 </sect2>
373
374</sect1>
Note: See TracBrowser for help on using the repository browser.