source: general/prog/python3.xml@ 0c25796

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 0c25796 was 0c25796, checked in by Pierre Labastie <pieere@…>, 4 years ago

Vim-8.2.0024
Python3-3.8.1

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

  • Property mode set to 100644
File size: 12.8 KB
RevLine 
[52d29f7]1<?xml version="1.0" encoding="ISO-8859-1"?>
[6732c094]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
[52d29f7]4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
[2cee003]7 <!ENTITY python3-download-http
[3f89ec5]8 "https://www.python.org/ftp/python/&python3-version;/Python-&python3-version;.tar.xz">
[355495ce]9 <!ENTITY python3-download-ftp " ">
[0c25796]10 <!ENTITY python3-md5sum "b3fb85fd479c0bf950c626ef80cacb57">
[9e91b25]11 <!ENTITY python3-size "17 MB">
[0c25796]12 <!ENTITY python3-buildsize "368 MB (add 40 MB for tests)">
13 <!ENTITY python3-time "1.3 SBU (add 4.4 SBU for tests, including rebuilding)">
[e882fc37]14 <!--
[73353e7f]15
16 Note: Size does not reflect docs that were install in LFS.
17
[2cee003]18 <!ENTITY python3htmldoc-download-http
[e882fc37]19 "https://docs.python.org/ftp/python/doc/&python3-version;/python-&python3-version;-docs-html.tar.bz2"> -->
[52d29f7]20]>
21
[b88be39]22<sect1 id="python3" xreflabel="Python-&python3-version;">
23 <?dbhtml filename="python3.html" ?>
[83f69e5d]24
25 <sect1info>
26 <othername>$LastChangedBy$</othername>
27 <date>$Date$</date>
28 </sect1info>
29
[b88be39]30 <title>Python-&python3-version;</title>
[83f69e5d]31
[b88be39]32 <indexterm zone="python3">
[03d30cf]33 <primary sortas="a-Python3">Python3</primary>
[83f69e5d]34 </indexterm>
35
36 <sect2 role="package">
[03d30cf]37 <title>Introduction to Python 3</title>
[83f69e5d]38
[355495ce]39 <para>
[03d30cf]40 The <application>Python 3</application> package contains the
[355495ce]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>
[48b816cb]45
[60ddbaf]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
[6030130]50 &lfs90_checked;
[48b816cb]51
[83f69e5d]52 <bridgehead renderas="sect3">Package Information</bridgehead>
53 <itemizedlist spacing="compact">
54 <listitem>
[355495ce]55 <para>
56 Download (HTTP): <ulink url="&python3-download-http;"/>
57 </para>
[83f69e5d]58 </listitem>
59 <listitem>
[355495ce]60 <para>
61 Download (FTP): <ulink url="&python3-download-ftp;"/>
62 </para>
[83f69e5d]63 </listitem>
64 <listitem>
[355495ce]65 <para>
66 Download MD5 sum: &python3-md5sum;
67 </para>
[83f69e5d]68 </listitem>
69 <listitem>
[355495ce]70 <para>
71 Download size: &python3-size;
72 </para>
[83f69e5d]73 </listitem>
74 <listitem>
[355495ce]75 <para>
76 Estimated disk space required: &python3-buildsize;
77 </para>
[83f69e5d]78 </listitem>
79 <listitem>
[355495ce]80 <para>
81 Estimated build time: &python3-time;
82 </para>
[83f69e5d]83 </listitem>
84 </itemizedlist>
[e882fc37]85
[03d30cf]86 <bridgehead renderas="sect3">Python 3 Dependencies</bridgehead>
[e882fc37]87
[f2ff0e4]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
[83f69e5d]97 <bridgehead renderas="sect4">Optional</bridgehead>
[355495ce]98 <para role="optional">
[7fe0ce3b]99 <xref linkend="bluez"/>,
[e882fc37]100 <xref linkend="gdb"/> (required for some tests),
101 <xref linkend="valgrind"/>, and
102 <ulink url="http://www.bytereef.org/mpdecimal">libmpcdec</ulink>
[355495ce]103 </para>
104
105 <bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
106 <para role="optional">
[6030130]107 <xref linkend="db"/>,
108 <xref linkend="sqlite"/>, and
109 <xref linkend="tk"/>
[355495ce]110 </para>
[ce33273]111
[1039de3]112 <para condition="html" role="usernotes">User Notes:
[355495ce]113 <ulink url="&blfs-wiki;/Python3"/>
114 </para>
[83f69e5d]115 </sect2>
116
117 <sect2 role="installation">
[03d30cf]118 <title>Installation of Python 3</title>
[83f69e5d]119
[355495ce]120 <para>
[03d30cf]121 Install <application>Python 3</application> by running the following
[355495ce]122 commands:
123 </para>
[83f69e5d]124
[fd69a62]125<screen><userinput>CXX="/usr/bin/g++" \
126./configure --prefix=/usr \
[c525bd1]127 --enable-shared \
[355495ce]128 --with-system-expat \
[fd69a62]129 --with-system-ffi \
[879932f]130 --with-ensurepip=yes &amp;&amp;
[83f69e5d]131make</userinput></screen>
132
[355495ce]133 <para>
[7fe0ce3b]134 The test suite must be run separately, using an X terminal (see below).
[355495ce]135 </para>
136
137 <para>
138 Now, as the <systemitem class="username">root</systemitem> user:
139 </para>
140
[82fac2c]141<screen role="root"><userinput>make install &amp;&amp;
[d10196e0]142<!--ln -sfv pip&python3-majorver; /usr/bin/pip3 &amp;&amp;-->
[9e91b25]143chmod -v 755 /usr/lib/libpython&python3-majorver;.so &amp;&amp;
[355495ce]144chmod -v 755 /usr/lib/libpython3.so</userinput></screen>
[1970f00]145
[7fe0ce3b]146 <para>
147 The test suite must be run separately from the build, either before or
[7745345d]148 after the package is built and installed. Do not run
[af8a78d]149 <command>make install</command> after running the test suite. To build
[7745345d]150 and install the package, you need to start with a fresh or clean source
[e882fc37]151 tree. For the tests, you also need a clean source code, so either start by
[7745345d]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>,
[d7d743f0]156 then <command>make test</command>. Remember that tests must be executed
[73353e7f]157 using an X terminal.
158 The test SBU highly depends on the speed of the internet connection.
[9e91b25]159 The test_sqlite test is known to fail.
[7fe0ce3b]160 </para>
161
[879d269]162 </sect2>
163
164 <sect2 role="commands">
165 <title>Command Explanations</title>
166
[fd69a62]167 <para>
168 <command> CXX="/usr/bin/g++" ./configure ...</command>: Avoid an annoying
169 message during configuration.
170 </para>
171
[355495ce]172 <para>
[f1d7196]173 <parameter>--with-system-expat</parameter>: This switch enables linking
174 against the system version of <application>Expat</application>.
[355495ce]175 </para>
176
177 <para>
[f1d7196]178 <parameter>--with-system-ffi</parameter>: This switch enables linking
[60ddbaf]179 against system version of <application>libffi</application>.
[82fac2c]180 </para>
[fd69a62]181
182 <para>
[23c5563]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.
[fd69a62]186 </para>
[82fac2c]187
[f1d7196]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
[7c57f82]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
[f2ff0e4]207 class="libraryfile">/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/libpython3.8.a</filename>
[7c57f82]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>
[d10196e0]212 <!--
[56da2817]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>
[d10196e0]218 -->
[355495ce]219 <para>
[0d7900a]220 <command>chmod ...</command>: Fix permissions for shared libraries to be
[355495ce]221 consistent with other libraries.
222 </para>
[7224506]223
[879d269]224 </sect2>
225
226 <sect2 role="configuration">
[03d30cf]227 <title>Configuring Python 3</title>
[879d269]228
[355495ce]229 <para>
[03d30cf]230 In order for <command>python3</command> to find the installed
[d7015e7]231 documentation, create the following version independent symlink:
[355495ce]232 </para>
[1970f00]233
[d7015e7]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>
[83f69e5d]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>
[355495ce]254 <seg>
[f2ff0e4]255 2to3 (symlink) and
[355495ce]256 2to3-&python3-majorver;,
257
[f2ff0e4]258 easy_install (symlink) and
259 easy_install-&python3-majorver;,
260
261 idle3 (symlink) and
262 idle&python3-majorver;,
[f5c5306]263
[f2ff0e4]264 pip3 (symlink) and
265 pip&python3-majorver;,
266
267 pydoc3 (symlink) and
[355495ce]268 pydoc&python3-majorver;,
269
[7fe0ce3b]270 python3 (symlink);
[f2ff0e4]271 python&python3-majorver;, and
[355495ce]272
[f2ff0e4]273 python3-config (symlink) and
274 python&python3-majorver;-config
275 <!--
[7fe0ce3b]276 pyvenv (symlink),
[f2ff0e4]277 pyvenv-&python3-majorver;
278 -->
[355495ce]279 </seg>
280 <seg>
[9e91b25]281 libpython&python3-majorver;.so and libpython3.so
[355495ce]282 </seg>
283 <seg>
[9e91b25]284 /usr/include/python&python3-majorver;,
[355495ce]285 /usr/lib/python&python3-majorver;, and
286 /usr/share/doc/python-&python3-version;
287 </seg>
[83f69e5d]288 </seglistitem>
289 </segmentedlist>
290
291 <variablelist>
292 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
293 <?dbfo list-presentation="list"?>
294 <?dbhtml list-presentation="table"?>
[f2ff0e4]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>
[83f69e5d]321
[355495ce]322 <varlistentry id="idle3">
323 <term><command>idle3</command></term>
[83f69e5d]324 <listitem>
[355495ce]325 <para>
[d0aecd33]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.
[355495ce]330 </para>
331 <indexterm zone="python3 idle3">
332 <primary sortas="b-idle3">idle3</primary>
[83f69e5d]333 </indexterm>
334 </listitem>
335 </varlistentry>
336
[355495ce]337 <varlistentry id="pydoc3">
338 <term><command>pydoc3</command></term>
[83f69e5d]339 <listitem>
[355495ce]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>
[83f69e5d]346 </indexterm>
347 </listitem>
348 </varlistentry>
349
[b88be39]350 <varlistentry id="python3-prog">
[2cee003]351 <term><command>python3</command></term>
[83f69e5d]352 <listitem>
[355495ce]353 <para>
354 is an interpreted, interactive, object-oriented programming
355 language.
356 </para>
[b88be39]357 <indexterm zone="python3 python3-prog">
358 <primary sortas="b-python3">python3</primary>
[83f69e5d]359 </indexterm>
360 </listitem>
361 </varlistentry>
362
[f67f5387]363 <varlistentry id="python-ver">
[b88be39]364 <term><command>python&python3-majorver;</command></term>
[83f69e5d]365 <listitem>
[355495ce]366 <para>
367 is a version-specific name for the <command>python</command>
368 program.
369 </para>
[b88be39]370 <indexterm zone="python3 python-ver">
[2cee003]371 <primary
372 sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
[83f69e5d]373 </indexterm>
374 </listitem>
375 </varlistentry>
[f2ff0e4]376 <!--
[21e8edc]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>
[f2ff0e4]390 -->
[83f69e5d]391 </variablelist>
392
393 </sect2>
[f45b1953]394
395</sect1>
Note: See TracBrowser for help on using the repository browser.