source: chapter08/python.xml@ ee16e55

11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 bdubbs/gcc13 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since ee16e55 was ee16e55, checked in by Xi Ruoyao <xry111@…>, 2 years ago

text fixes for wheel change

  • Add description for "wheel" command
  • Explain why pip3 warning does not matter for us
  • Format and typo fixes
  • Property mode set to 100644
File size: 7.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
8<sect1 id="ch-system-Python" role="wrap">
9 <?dbhtml filename="Python.html"?>
10
11 <sect1info condition="script">
12 <productname>Python</productname>
13 <productnumber>&python-version;</productnumber>
14 <address>&python-url;</address>
15 </sect1info>
16
17 <title>Python-&python-version;</title>
18
19 <indexterm zone="ch-system-Python">
20 <primary sortas="a-Python">Python</primary>
21 </indexterm>
22
23 <sect2 role="package">
24 <title/>
25
26 <para>The Python 3 package contains the Python development environment. It
27 is useful for object-oriented programming, writing scripts, prototyping
28 large programs, or developing entire applications.</para>
29
30 <segmentedlist>
31 <segtitle>&buildtime;</segtitle>
32 <segtitle>&diskspace;</segtitle>
33
34 <seglistitem>
35 <seg>&python-fin-sbu;</seg>
36 <seg>&python-fin-du;</seg>
37 </seglistitem>
38 </segmentedlist>
39
40 </sect2>
41
42 <sect2 role="installation">
43 <title>Installation of Python 3</title>
44
45 <para>Prepare Python for compilation:</para>
46
47<screen><userinput remap="configure">./configure --prefix=/usr \
48 --enable-shared \
49 --with-system-expat \
50 --with-system-ffi \
51 --enable-optimizations</userinput></screen>
52
53 <variablelist>
54 <title>The meaning of the configure options:</title>
55
56 <varlistentry>
57 <term><parameter>--with-system-expat</parameter></term>
58 <listitem>
59 <para>This switch enables linking against system version of
60 <application>Expat</application>.</para>
61 </listitem>
62 </varlistentry>
63
64 <varlistentry>
65 <term><parameter>--with-system-ffi</parameter></term>
66 <listitem>
67 <para>This switch enables linking against system version of
68 <application>libffi</application>.</para>
69 </listitem>
70 </varlistentry>
71
72 <varlistentry>
73 <term><parameter>--enable-optimizations</parameter></term>
74 <listitem>
75 <para>This switch enables stable, but expensive, optimizations.</para>
76 </listitem>
77 </varlistentry>
78
79 </variablelist>
80
81 <para>Compile the package:</para>
82
83<screen><userinput remap="make">make</userinput></screen>
84
85 <para>Running the tests at this point is not recommended. The
86 tests are known to hang indefinitely in the partial LFS environment.
87 If desired, the tests can be rerun at the end of this chapter or
88 when Python 3 is reinstalled in BLFS. To run the tests anyway,
89 issue <command>make test</command>.</para>
90
91 <para>Install the package:</para>
92
93<screen><userinput remap="install">make install</userinput></screen>
94
95 <para>In serveral places we use the <command>pip3</command> command to
96 install Python 3 programs and modules for all users as
97 <systemitem class='username'>root</systemitem>. This conflicts
98 with the Python developers recommendation to install packages into a
99 virtual environment or the home directory of a regular user (by running
100 <command>pip3</command> as this user). To this end, a multi-line warning
101 is written when using <command>pip3</command> as the
102 <systemitem class='username'>root</systemitem> user. The main reason
103 of this recommendation is for avoiding a conflict with the system
104 package manager (<command>dpkg</command> for example), but LFS does not
105 have a system-wide package manager so this is not a problem. If desired,
106 suppress this warning by running the following command:</para>
107
108<screen><userinput remap="install">sed -e '/def warn_if_run_as_root/a\ return' \
109 -i /usr/lib/python3.10/site-packages/pip/_internal/cli/req_command.py
110</userinput></screen>
111
112
113 <para>If desired, install the preformatted documentation:</para>
114
115<screen><userinput remap="install">install -v -dm755 /usr/share/doc/python-&python-version;/html
116
117tar --strip-components=1 \
118 --no-same-owner \
119 --no-same-permissions \
120 -C /usr/share/doc/python-&python-version;/html \
121 -xvf ../python-&python-version;-docs-html.tar.bz2</userinput></screen>
122
123 <variablelist>
124 <title>The meaning of the documentation install commands:</title>
125
126 <varlistentry>
127 <term><option>--no-same-owner</option> and <option>--no-same-permissions</option></term>
128 <listitem>
129 <para>Ensure the installed files have the correct ownership and
130 permissions. Without these options, using <application>tar</application>
131 will install the package files with the upstream creator's values.
132 </para>
133 </listitem>
134 </varlistentry>
135
136 </variablelist>
137
138 </sect2>
139
140 <sect2 id="contents-python" role="content">
141 <title>Contents of Python 3</title>
142
143 <segmentedlist>
144 <segtitle>Installed Programs</segtitle>
145 <segtitle>Installed Library</segtitle>
146 <segtitle>Installed Directories</segtitle>
147
148 <seglistitem>
149 <seg>
150 2to3, idle3, pip3, pydoc3, python3, and python3-config
151 </seg>
152 <seg>
153 libpython&python-minor;.so and libpython3.so
154 </seg>
155 <seg>
156 /usr/include/python&python-minor;,
157 /usr/lib/python3, and
158 /usr/share/doc/python-&python-version;
159 </seg>
160 </seglistitem>
161 </segmentedlist>
162
163 <variablelist>
164 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
165 <?dbfo list-presentation="list"?>
166 <?dbhtml list-presentation="table"?>
167
168 <varlistentry id="python-2to3">
169 <term><command>2to3</command></term>
170 <listitem>
171 <para>
172 is a <application>Python</application> program that reads
173 <application>Python 2.x</application> source code and applies a
174 series of fixes to transform it into
175 valid <application>Python 3.x</application> code
176 </para>
177 <indexterm zone="ch-system-Python">
178 <primary sortas="b-2to3">2to3</primary>
179 </indexterm>
180 </listitem>
181 </varlistentry>
182
183 <varlistentry id="idle3">
184 <term><command>idle3</command></term>
185 <listitem>
186 <para>
187 is a wrapper script that opens a <application>Python</application>
188 aware GUI editor. For this script to run, you must have installed
189 <application>Tk</application> before Python so that the Tkinter
190 Python module is built
191 </para>
192 <indexterm zone="ch-system-Python">
193 <primary sortas="b-idle3">idle3</primary>
194 </indexterm>
195 </listitem>
196 </varlistentry>
197
198 <varlistentry id="pip3">
199 <term><command>pip3</command></term>
200 <listitem>
201 <para>
202 The package installer for Python. You can use pip to install
203 packages from Python Package Index and other indexes
204 </para>
205 <indexterm zone="ch-system-Python">
206 <primary sortas="b-pip3">pip3</primary>
207 </indexterm>
208 </listitem>
209 </varlistentry>
210
211 <varlistentry id="pydoc3">
212 <term><command>pydoc3</command></term>
213 <listitem>
214 <para>
215 is the <application>Python</application> documentation tool
216 </para>
217 <indexterm zone="ch-system-Python">
218 <primary sortas="b-pydoc3">pydoc3</primary>
219 </indexterm>
220 </listitem>
221 </varlistentry>
222
223 <varlistentry id="python3">
224 <term><command>python3</command></term>
225 <listitem>
226 <para>
227 is an interpreted, interactive, object-oriented programming
228 language
229 </para>
230 <indexterm zone="ch-system-Python">
231 <primary sortas="b-python3">python3</primary>
232 </indexterm>
233 </listitem>
234 </varlistentry>
235
236 </variablelist>
237
238 </sect2>
239
240</sect1>
241
Note: See TracBrowser for help on using the repository browser.