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 "eb8c2a6b1447d50813c02714af4681f3">
|
---|
11 | <!ENTITY python3-size "16 MB">
|
---|
12 | <!ENTITY python3-buildsize "175 MB (add 29 MB for tests)">
|
---|
13 | <!ENTITY python3-time "0.9 SBU (using parallelism=4; add 1.7 SBU for tests)">
|
---|
14 |
|
---|
15 | <!ENTITY python3htmldoc-download-http
|
---|
16 | "https://docs.python.org/ftp/python/doc/&python3-version;/python-&python3-version;-docs-html.tar.bz2">
|
---|
17 | ]>
|
---|
18 |
|
---|
19 | <sect1 id="python3" xreflabel="Python-&python3-version;">
|
---|
20 | <?dbhtml filename="python3.html" ?>
|
---|
21 |
|
---|
22 | <sect1info>
|
---|
23 | <othername>$LastChangedBy$</othername>
|
---|
24 | <date>$Date$</date>
|
---|
25 | </sect1info>
|
---|
26 |
|
---|
27 | <title>Python-&python3-version;</title>
|
---|
28 |
|
---|
29 | <indexterm zone="python3">
|
---|
30 | <primary sortas="a-Python3">Python3</primary>
|
---|
31 | </indexterm>
|
---|
32 |
|
---|
33 | <sect2 role="package">
|
---|
34 | <title>Introduction to Python 3</title>
|
---|
35 |
|
---|
36 | <para>
|
---|
37 | The <application>Python 3</application> package contains the
|
---|
38 | <application>Python</application> development environment.
|
---|
39 | This is useful for object-oriented programming, writing scripts,
|
---|
40 | prototyping large programs or developing entire applications.
|
---|
41 | </para>
|
---|
42 |
|
---|
43 | <note><para><application>Python 3</application> was installed in LFS.
|
---|
44 | The only reason to rebuild it here is if optional modules
|
---|
45 | are needed.</para></note>
|
---|
46 |
|
---|
47 | &lfs83_checked;
|
---|
48 |
|
---|
49 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
50 | <itemizedlist spacing="compact">
|
---|
51 | <listitem>
|
---|
52 | <para>
|
---|
53 | Download (HTTP): <ulink url="&python3-download-http;"/>
|
---|
54 | </para>
|
---|
55 | </listitem>
|
---|
56 | <listitem>
|
---|
57 | <para>
|
---|
58 | Download (FTP): <ulink url="&python3-download-ftp;"/>
|
---|
59 | </para>
|
---|
60 | </listitem>
|
---|
61 | <listitem>
|
---|
62 | <para>
|
---|
63 | Download MD5 sum: &python3-md5sum;
|
---|
64 | </para>
|
---|
65 | </listitem>
|
---|
66 | <listitem>
|
---|
67 | <para>
|
---|
68 | Download size: &python3-size;
|
---|
69 | </para>
|
---|
70 | </listitem>
|
---|
71 | <listitem>
|
---|
72 | <para>
|
---|
73 | Estimated disk space required: &python3-buildsize;
|
---|
74 | </para>
|
---|
75 | </listitem>
|
---|
76 | <listitem>
|
---|
77 | <para>
|
---|
78 | Estimated build time: &python3-time;
|
---|
79 | </para>
|
---|
80 | </listitem>
|
---|
81 | </itemizedlist>
|
---|
82 | <!--
|
---|
83 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
84 | <itemizedlist spacing="compact">
|
---|
85 | <title>Optional HTML Documentation</title>
|
---|
86 | <listitem>
|
---|
87 | <para>
|
---|
88 | Download (HTTP): <ulink url="&python3htmldoc-download-http;"/>
|
---|
89 | </para>
|
---|
90 | </listitem>
|
---|
91 | </itemizedlist>
|
---|
92 | -->
|
---|
93 | <bridgehead renderas="sect3">Python 3 Dependencies</bridgehead>
|
---|
94 | <!--
|
---|
95 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
96 | <para role="recommended">
|
---|
97 | <xref linkend="libffi"/>
|
---|
98 | </para>
|
---|
99 | -->
|
---|
100 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
101 | <para role="optional">
|
---|
102 | <xref linkend="bluez"/>,
|
---|
103 | <xref linkend="gdb"/> (required for some tests), and
|
---|
104 | <xref linkend="valgrind"/>
|
---|
105 | </para>
|
---|
106 |
|
---|
107 | <bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
|
---|
108 | <para role="optional">
|
---|
109 | <xref linkend="db"/> and
|
---|
110 | <xref linkend="sqlite"/>
|
---|
111 | </para>
|
---|
112 |
|
---|
113 | <para condition="html" role="usernotes">User Notes:
|
---|
114 | <ulink url="&blfs-wiki;/Python3"/>
|
---|
115 | </para>
|
---|
116 | </sect2>
|
---|
117 |
|
---|
118 | <sect2 role="installation">
|
---|
119 | <title>Installation of Python 3</title>
|
---|
120 |
|
---|
121 | <para>
|
---|
122 | Install <application>Python 3</application> by running the following
|
---|
123 | commands:
|
---|
124 | </para>
|
---|
125 |
|
---|
126 | <screen><userinput>CXX="/usr/bin/g++" \
|
---|
127 | ./configure --prefix=/usr \
|
---|
128 | --enable-shared \
|
---|
129 | --with-system-expat \
|
---|
130 | --with-system-ffi \
|
---|
131 | --with-ensurepip=yes &&
|
---|
132 | make</userinput></screen>
|
---|
133 |
|
---|
134 | <para>
|
---|
135 | The test suite must be run separately, using an X terminal (see below).
|
---|
136 | </para>
|
---|
137 |
|
---|
138 | <para>
|
---|
139 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
140 | </para>
|
---|
141 |
|
---|
142 | <screen role="root"><userinput>make install &&
|
---|
143 | chmod -v 755 /usr/lib/libpython&python3-majorver;m.so &&
|
---|
144 | chmod -v 755 /usr/lib/libpython3.so</userinput></screen>
|
---|
145 | <!--
|
---|
146 | <para>
|
---|
147 | If you have downloaded the preformatted documentation from
|
---|
148 | <ulink url="http://docs.python.org/download.html"/>, install it
|
---|
149 | as the <systemitem class="username">root</systemitem> user:
|
---|
150 | </para>
|
---|
151 |
|
---|
152 | <screen role="root"><userinput>install -v -dm755 /usr/share/doc/python-&python3-version;/html &&
|
---|
153 | tar - -strip-components=1 \
|
---|
154 | - -no-same-owner \
|
---|
155 | - -no-same-permissions \
|
---|
156 | -C /usr/share/doc/python-&python3-version;/html \
|
---|
157 | -xvf ../python-&python3-version;-docs-html.tar.bz2</userinput></screen>
|
---|
158 | -->
|
---|
159 | <para>
|
---|
160 | The test suite must be run separately from the build, either before or
|
---|
161 | after the package is built and installed. Do not run
|
---|
162 | <command>make install</command> after running the test suite. To build
|
---|
163 | and install the package, you need to start with a fresh or clean source
|
---|
164 | tree. For the test, you also need a clean source code, so either start by
|
---|
165 | removing the source code directory and starting over, by uncompressing
|
---|
166 | the source tarball or by running <command>make clean</command>. Then
|
---|
167 | configure again, adding <quote>--with-pydebug</quote> to the
|
---|
168 | <command>configure</command> switches above, run <command>make</command>,
|
---|
169 | then <command>make test</command>. Remember that tests must be executed
|
---|
170 | using an X terminal. One test fails. The test SBU highly depends on the
|
---|
171 | speed of the internet connection.
|
---|
172 | </para>
|
---|
173 |
|
---|
174 | </sect2>
|
---|
175 |
|
---|
176 | <sect2 role="commands">
|
---|
177 | <title>Command Explanations</title>
|
---|
178 |
|
---|
179 | <para>
|
---|
180 | <command> CXX="/usr/bin/g++" ./configure ...</command>: Avoid an annoying
|
---|
181 | message during configuration.
|
---|
182 | </para>
|
---|
183 |
|
---|
184 | <para>
|
---|
185 | <parameter>--with-system-expat</parameter>: This switch enables linking
|
---|
186 | against the system version of <application>Expat</application>.
|
---|
187 | </para>
|
---|
188 |
|
---|
189 | <para>
|
---|
190 | <parameter>--with-system-ffi</parameter>: This switch enables linking
|
---|
191 | against system version of <application>libffi</application>.
|
---|
192 | </para>
|
---|
193 |
|
---|
194 | <para>
|
---|
195 | <parameter>--with-ensurepip=yes</parameter> : This switch enables building
|
---|
196 | <command>pip</command> and <command>setuptools</command> packaging programs.
|
---|
197 | <command>setuptools</command> is needed for building some Python modules.
|
---|
198 | </para>
|
---|
199 |
|
---|
200 | <para>
|
---|
201 | <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
|
---|
202 | if you want to build <application>Python</application> DBM Module
|
---|
203 | against <application>Berkeley DB</application> instead of
|
---|
204 | <application>GDBM</application>.
|
---|
205 | </para>
|
---|
206 |
|
---|
207 | <para>
|
---|
208 | <command>chmod ...</command>: Fix permissions for shared libraries to be
|
---|
209 | consistent with other libraries.
|
---|
210 | </para>
|
---|
211 |
|
---|
212 | </sect2>
|
---|
213 |
|
---|
214 | <sect2 role="configuration">
|
---|
215 | <title>Configuring Python 3</title>
|
---|
216 |
|
---|
217 | <para>
|
---|
218 | In order for <command>python3</command> to find the installed
|
---|
219 | documentation, create the following version independent symlink:
|
---|
220 | </para>
|
---|
221 |
|
---|
222 | <screen role="root"><userinput>ln -svfn python-&python3-version; /usr/share/doc/python-3</userinput></screen>
|
---|
223 |
|
---|
224 | <para>
|
---|
225 | and add the following environment variable to the individual user's or
|
---|
226 | system's profile:
|
---|
227 | </para>
|
---|
228 |
|
---|
229 | <screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-3/html</userinput></screen>
|
---|
230 |
|
---|
231 | </sect2>
|
---|
232 |
|
---|
233 | <sect2 role="content">
|
---|
234 | <title>Contents</title>
|
---|
235 |
|
---|
236 | <segmentedlist>
|
---|
237 | <segtitle>Installed Programs</segtitle>
|
---|
238 | <segtitle>Installed Libraries</segtitle>
|
---|
239 | <segtitle>Installed Directories</segtitle>
|
---|
240 |
|
---|
241 | <seglistitem>
|
---|
242 | <seg>
|
---|
243 | 2to3 (symlink),
|
---|
244 | 2to3-&python3-majorver;,
|
---|
245 |
|
---|
246 | idle3 (symlink), and
|
---|
247 | idle&python3-majorver;
|
---|
248 |
|
---|
249 | pydoc3 (symlink),
|
---|
250 | pydoc&python3-majorver;,
|
---|
251 |
|
---|
252 | python3 (symlink);
|
---|
253 | python&python3-majorver; and python&python3-majorver;m (hardlinked);
|
---|
254 |
|
---|
255 | python3-config (symlink),
|
---|
256 | python&python3-majorver;-config (symlink),
|
---|
257 | python&python3-majorver;m-config,
|
---|
258 |
|
---|
259 | pyvenv (symlink),
|
---|
260 | pyvenv-&python3-majorver;,
|
---|
261 | </seg>
|
---|
262 | <seg>
|
---|
263 | libpython&python3-majorver;m.so and libpython3.so
|
---|
264 | </seg>
|
---|
265 | <seg>
|
---|
266 | /usr/include/python&python3-majorver;m,
|
---|
267 | /usr/lib/python&python3-majorver;, and
|
---|
268 | /usr/share/doc/python-&python3-version;
|
---|
269 | </seg>
|
---|
270 | </seglistitem>
|
---|
271 | </segmentedlist>
|
---|
272 |
|
---|
273 | <variablelist>
|
---|
274 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
275 | <?dbfo list-presentation="list"?>
|
---|
276 | <?dbhtml list-presentation="table"?>
|
---|
277 |
|
---|
278 | <varlistentry id="idle3">
|
---|
279 | <term><command>idle3</command></term>
|
---|
280 | <listitem>
|
---|
281 | <para>
|
---|
282 | is a wrapper script that opens a <application>Python</application>
|
---|
283 | aware GUI editor. For this script to run, you must have installed
|
---|
284 | <application>Tk</application> before Python so that the Tkinter
|
---|
285 | Python module is built.
|
---|
286 | </para>
|
---|
287 | <indexterm zone="python3 idle3">
|
---|
288 | <primary sortas="b-idle3">idle3</primary>
|
---|
289 | </indexterm>
|
---|
290 | </listitem>
|
---|
291 | </varlistentry>
|
---|
292 |
|
---|
293 | <varlistentry id="pydoc3">
|
---|
294 | <term><command>pydoc3</command></term>
|
---|
295 | <listitem>
|
---|
296 | <para>
|
---|
297 | is the <application>Python</application> documentation
|
---|
298 | tool.
|
---|
299 | </para>
|
---|
300 | <indexterm zone="python3 pydoc3">
|
---|
301 | <primary sortas="b-pydoc3">pydo3c</primary>
|
---|
302 | </indexterm>
|
---|
303 | </listitem>
|
---|
304 | </varlistentry>
|
---|
305 |
|
---|
306 | <varlistentry id="python3-prog">
|
---|
307 | <term><command>python3</command></term>
|
---|
308 | <listitem>
|
---|
309 | <para>
|
---|
310 | is an interpreted, interactive, object-oriented programming
|
---|
311 | language.
|
---|
312 | </para>
|
---|
313 | <indexterm zone="python3 python3-prog">
|
---|
314 | <primary sortas="b-python3">python3</primary>
|
---|
315 | </indexterm>
|
---|
316 | </listitem>
|
---|
317 | </varlistentry>
|
---|
318 |
|
---|
319 | <varlistentry id="python-ver">
|
---|
320 | <term><command>python&python3-majorver;</command></term>
|
---|
321 | <listitem>
|
---|
322 | <para>
|
---|
323 | is a version-specific name for the <command>python</command>
|
---|
324 | program.
|
---|
325 | </para>
|
---|
326 | <indexterm zone="python3 python-ver">
|
---|
327 | <primary
|
---|
328 | sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
|
---|
329 | </indexterm>
|
---|
330 | </listitem>
|
---|
331 | </varlistentry>
|
---|
332 |
|
---|
333 | <varlistentry id="pyvenv">
|
---|
334 | <term><command>pyvenv</command></term>
|
---|
335 | <listitem>
|
---|
336 | <para>
|
---|
337 | creates virtual <application>Python</application> environments in
|
---|
338 | one or more target directories.
|
---|
339 | </para>
|
---|
340 | <indexterm zone="python3 pyvenv">
|
---|
341 | <primary
|
---|
342 | sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
|
---|
343 | </indexterm>
|
---|
344 | </listitem>
|
---|
345 | </varlistentry>
|
---|
346 |
|
---|
347 | </variablelist>
|
---|
348 |
|
---|
349 | </sect2>
|
---|
350 |
|
---|
351 | </sect1>
|
---|