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 "df6ec36011808205beda239c72f947cb">
|
---|
11 | <!ENTITY python3-size "16 MB">
|
---|
12 | <!ENTITY python3-buildsize "337 MB (add 29 MB for tests)">
|
---|
13 | <!ENTITY python3-time "1.2 SBU (add 2.0 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">Python 3 Dependencies</bridgehead>
|
---|
84 |
|
---|
85 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
86 | <para role="optional">
|
---|
87 | <xref linkend="bluez"/>,
|
---|
88 | <xref linkend="gdb"/> (required for some tests),
|
---|
89 | <xref linkend="valgrind"/>, and
|
---|
90 | <ulink url="http://www.bytereef.org/mpdecimal">libmpcdec</ulink>
|
---|
91 | </para>
|
---|
92 |
|
---|
93 | <bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
|
---|
94 | <para role="optional">
|
---|
95 | <xref linkend="db"/> and
|
---|
96 | <xref linkend="sqlite"/>
|
---|
97 | </para>
|
---|
98 |
|
---|
99 | <para condition="html" role="usernotes">User Notes:
|
---|
100 | <ulink url="&blfs-wiki;/Python3"/>
|
---|
101 | </para>
|
---|
102 | </sect2>
|
---|
103 |
|
---|
104 | <sect2 role="installation">
|
---|
105 | <title>Installation of Python 3</title>
|
---|
106 |
|
---|
107 | <para>
|
---|
108 | Install <application>Python 3</application> by running the following
|
---|
109 | commands:
|
---|
110 | </para>
|
---|
111 |
|
---|
112 | <screen><userinput>CXX="/usr/bin/g++" \
|
---|
113 | ./configure --prefix=/usr \
|
---|
114 | --enable-shared \
|
---|
115 | --with-system-expat \
|
---|
116 | --with-system-ffi \
|
---|
117 | --with-ensurepip=yes &&
|
---|
118 | make</userinput></screen>
|
---|
119 |
|
---|
120 | <para>
|
---|
121 | The test suite must be run separately, using an X terminal (see below).
|
---|
122 | </para>
|
---|
123 |
|
---|
124 | <para>
|
---|
125 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
126 | </para>
|
---|
127 |
|
---|
128 | <screen role="root"><userinput>make install &&
|
---|
129 | chmod -v 755 /usr/lib/libpython&python3-majorver;m.so &&
|
---|
130 | chmod -v 755 /usr/lib/libpython3.so</userinput></screen>
|
---|
131 |
|
---|
132 | <para>
|
---|
133 | The test suite must be run separately from the build, either before or
|
---|
134 | after the package is built and installed. Do not run
|
---|
135 | <command>make install</command> after running the test suite. To build
|
---|
136 | and install the package, you need to start with a fresh or clean source
|
---|
137 | tree. For the tests, you also need a clean source code, so either start by
|
---|
138 | removing the source code directory and starting over, by uncompressing
|
---|
139 | the source tarball or by running <command>make clean</command>. Then
|
---|
140 | configure again, adding <quote>--with-pydebug</quote> to the
|
---|
141 | <command>configure</command> switches above, run <command>make</command>,
|
---|
142 | then <command>make test</command>. Remember that tests must be executed
|
---|
143 | using an X terminal. Two tests fail. The test SBU highly depends on the
|
---|
144 | speed of the internet connection.
|
---|
145 | </para>
|
---|
146 |
|
---|
147 | </sect2>
|
---|
148 |
|
---|
149 | <sect2 role="commands">
|
---|
150 | <title>Command Explanations</title>
|
---|
151 |
|
---|
152 | <para>
|
---|
153 | <command> CXX="/usr/bin/g++" ./configure ...</command>: Avoid an annoying
|
---|
154 | message during configuration.
|
---|
155 | </para>
|
---|
156 |
|
---|
157 | <para>
|
---|
158 | <parameter>--with-system-expat</parameter>: This switch enables linking
|
---|
159 | against the system version of <application>Expat</application>.
|
---|
160 | </para>
|
---|
161 |
|
---|
162 | <para>
|
---|
163 | <parameter>--with-system-ffi</parameter>: This switch enables linking
|
---|
164 | against system version of <application>libffi</application>.
|
---|
165 | </para>
|
---|
166 |
|
---|
167 | <para>
|
---|
168 | <parameter>--with-ensurepip=yes</parameter> : This switch enables building
|
---|
169 | <command>pip</command> and <command>setuptools</command> packaging programs.
|
---|
170 | <command>setuptools</command> is needed for building some Python modules.
|
---|
171 | </para>
|
---|
172 |
|
---|
173 | <para>
|
---|
174 | <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
|
---|
175 | if you want to build <application>Python</application> DBM Module
|
---|
176 | against <application>Berkeley DB</application> instead of
|
---|
177 | <application>GDBM</application>.
|
---|
178 | </para>
|
---|
179 |
|
---|
180 | <para>
|
---|
181 | <command>chmod ...</command>: Fix permissions for shared libraries to be
|
---|
182 | consistent with other libraries.
|
---|
183 | </para>
|
---|
184 |
|
---|
185 | </sect2>
|
---|
186 |
|
---|
187 | <sect2 role="configuration">
|
---|
188 | <title>Configuring Python 3</title>
|
---|
189 |
|
---|
190 | <para>
|
---|
191 | In order for <command>python3</command> to find the installed
|
---|
192 | documentation, create the following version independent symlink:
|
---|
193 | </para>
|
---|
194 |
|
---|
195 | <screen role="root"><userinput>ln -svfn python-&python3-version; /usr/share/doc/python-3</userinput></screen>
|
---|
196 |
|
---|
197 | <para>
|
---|
198 | and add the following environment variable to the individual user's or
|
---|
199 | system's profile:
|
---|
200 | </para>
|
---|
201 |
|
---|
202 | <screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-3/html</userinput></screen>
|
---|
203 |
|
---|
204 | </sect2>
|
---|
205 |
|
---|
206 | <sect2 role="content">
|
---|
207 | <title>Contents</title>
|
---|
208 |
|
---|
209 | <segmentedlist>
|
---|
210 | <segtitle>Installed Programs</segtitle>
|
---|
211 | <segtitle>Installed Libraries</segtitle>
|
---|
212 | <segtitle>Installed Directories</segtitle>
|
---|
213 |
|
---|
214 | <seglistitem>
|
---|
215 | <seg>
|
---|
216 | 2to3 (symlink),
|
---|
217 | 2to3-&python3-majorver;,
|
---|
218 |
|
---|
219 | idle3 (symlink), and
|
---|
220 | idle&python3-majorver;
|
---|
221 |
|
---|
222 | pydoc3 (symlink),
|
---|
223 | pydoc&python3-majorver;,
|
---|
224 |
|
---|
225 | python3 (symlink);
|
---|
226 | python&python3-majorver; and python&python3-majorver;m (hardlinked);
|
---|
227 |
|
---|
228 | python3-config (symlink),
|
---|
229 | python&python3-majorver;-config (symlink),
|
---|
230 | python&python3-majorver;m-config,
|
---|
231 |
|
---|
232 | pyvenv (symlink),
|
---|
233 | pyvenv-&python3-majorver;,
|
---|
234 | </seg>
|
---|
235 | <seg>
|
---|
236 | libpython&python3-majorver;m.so and libpython3.so
|
---|
237 | </seg>
|
---|
238 | <seg>
|
---|
239 | /usr/include/python&python3-majorver;m,
|
---|
240 | /usr/lib/python&python3-majorver;, and
|
---|
241 | /usr/share/doc/python-&python3-version;
|
---|
242 | </seg>
|
---|
243 | </seglistitem>
|
---|
244 | </segmentedlist>
|
---|
245 |
|
---|
246 | <variablelist>
|
---|
247 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
248 | <?dbfo list-presentation="list"?>
|
---|
249 | <?dbhtml list-presentation="table"?>
|
---|
250 |
|
---|
251 | <varlistentry id="idle3">
|
---|
252 | <term><command>idle3</command></term>
|
---|
253 | <listitem>
|
---|
254 | <para>
|
---|
255 | is a wrapper script that opens a <application>Python</application>
|
---|
256 | aware GUI editor. For this script to run, you must have installed
|
---|
257 | <application>Tk</application> before Python so that the Tkinter
|
---|
258 | Python module is built.
|
---|
259 | </para>
|
---|
260 | <indexterm zone="python3 idle3">
|
---|
261 | <primary sortas="b-idle3">idle3</primary>
|
---|
262 | </indexterm>
|
---|
263 | </listitem>
|
---|
264 | </varlistentry>
|
---|
265 |
|
---|
266 | <varlistentry id="pydoc3">
|
---|
267 | <term><command>pydoc3</command></term>
|
---|
268 | <listitem>
|
---|
269 | <para>
|
---|
270 | is the <application>Python</application> documentation
|
---|
271 | tool.
|
---|
272 | </para>
|
---|
273 | <indexterm zone="python3 pydoc3">
|
---|
274 | <primary sortas="b-pydoc3">pydo3c</primary>
|
---|
275 | </indexterm>
|
---|
276 | </listitem>
|
---|
277 | </varlistentry>
|
---|
278 |
|
---|
279 | <varlistentry id="python3-prog">
|
---|
280 | <term><command>python3</command></term>
|
---|
281 | <listitem>
|
---|
282 | <para>
|
---|
283 | is an interpreted, interactive, object-oriented programming
|
---|
284 | language.
|
---|
285 | </para>
|
---|
286 | <indexterm zone="python3 python3-prog">
|
---|
287 | <primary sortas="b-python3">python3</primary>
|
---|
288 | </indexterm>
|
---|
289 | </listitem>
|
---|
290 | </varlistentry>
|
---|
291 |
|
---|
292 | <varlistentry id="python-ver">
|
---|
293 | <term><command>python&python3-majorver;</command></term>
|
---|
294 | <listitem>
|
---|
295 | <para>
|
---|
296 | is a version-specific name for the <command>python</command>
|
---|
297 | program.
|
---|
298 | </para>
|
---|
299 | <indexterm zone="python3 python-ver">
|
---|
300 | <primary
|
---|
301 | sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
|
---|
302 | </indexterm>
|
---|
303 | </listitem>
|
---|
304 | </varlistentry>
|
---|
305 |
|
---|
306 | <varlistentry id="pyvenv">
|
---|
307 | <term><command>pyvenv</command></term>
|
---|
308 | <listitem>
|
---|
309 | <para>
|
---|
310 | creates virtual <application>Python</application> environments in
|
---|
311 | one or more target directories.
|
---|
312 | </para>
|
---|
313 | <indexterm zone="python3 pyvenv">
|
---|
314 | <primary
|
---|
315 | sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
|
---|
316 | </indexterm>
|
---|
317 | </listitem>
|
---|
318 | </varlistentry>
|
---|
319 |
|
---|
320 | </variablelist>
|
---|
321 |
|
---|
322 | </sect2>
|
---|
323 |
|
---|
324 | </sect1>
|
---|