source: general/prog/python3.xml@ a87fb41

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 a87fb41 was a87fb41, checked in by Xi Ruoyao <xry111@…>, 3 years ago

python3: sync with LFS

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