Changeset 8e751f7
- Timestamp:
- 12/07/2022 06:54:04 PM (17 months ago)
- Branches:
- 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, bdubbs/gcc13, multilib, renodr/libudev-from-systemd, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/update-glibc
- Children:
- 156a414e, d988306
- Parents:
- e9c46b3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter08/python.xml
re9c46b3 r8e751f7 26 26 <para>The Python 3 package contains the Python development environment. It 27 27 is useful for object-oriented programming, writing scripts, prototyping 28 large programs, or developing entire applications.</para> 28 large programs, and developing entire applications. Python is an interpreted 29 computer language.</para> 29 30 30 31 <segmentedlist> … … 57 58 <term><parameter>--with-system-expat</parameter></term> 58 59 <listitem> 59 <para>This switch enables linking against system version of60 <para>This switch enables linking against the system version of 60 61 <application>Expat</application>.</para> 61 62 </listitem> … … 65 66 <term><parameter>--with-system-ffi</parameter></term> 66 67 <listitem> 67 <para>This switch enables linking against system version of68 <application>libffi </application>.</para>68 <para>This switch enables linking against the system version of 69 <application>libffi.so</application>.</para> 69 70 </listitem> 70 71 </varlistentry> … … 73 74 <term><parameter>--enable-optimizations</parameter></term> 74 75 <listitem> 75 <para>This switch enables stable, but expensive, optimizations.</para> 76 <para>This switch enables extensive, but time-consuming, optimization 77 steps. The interpreter is built twice; tests performed on the first 78 build are used to improve the optimized final version.</para> 79 <!-- This description was drawn from the README.rst file 80 in the Python-3.11.0 package. --> 76 81 </listitem> 77 82 </varlistentry> … … 85 90 <para>Running the tests at this point is not recommended. The 86 91 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 or92 If desired, the tests can be rerun at the end of this chapter, or 88 93 when Python 3 is reinstalled in BLFS. To run the tests anyway, 89 94 issue <command>make test</command>.</para> … … 93 98 <screen><userinput remap="install">make install</userinput></screen> 94 99 95 <para> In several places we use the <command>pip3</command> command to100 <para>We use the <command>pip3</command> command to 96 101 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. And, 106 <command>pip3</command> will attempt to check for a new version of 107 itself whenever it's run. As domain name resolving is not configured 108 yet in LFS chroot environment, it will fail to check for a new version 109 and produce a warning. Once we boot the LFS system and set up network 110 connection, it will then produce a warning telling the user to update it 111 from a pre-built wheel on PyPI if any new version is available. But LFS 112 consider <command>pip3</command> a part of Python 3 so it should not be 113 updated separately, and an update from a pre-built wheel will deviate 114 from our purpose to build a Linux system from source code. So the 115 warning for a new <command>pip3</command> version should be ignored as 116 well. If desired, suppress these warnings by running the following 117 commands:</para> 102 <systemitem class='username'>root</systemitem> in several places in this book. 103 This conflicts with the Python developers' recommendation: to install packages into a 104 virtual environment, or into the home directory of a regular user (by running 105 <command>pip3</command> as this user). A multi-line warning 106 is triggered whenever <command>pip3</command> is issued by the 107 <systemitem class='username'>root</systemitem> user.</para> 108 109 <para>The main reason 110 for the recommendation is to avoid conflicts with the system's 111 package manager (<command>dpkg</command>, for example). LFS does not 112 have a system-wide package manager, so this is not a problem. Also, 113 <command>pip3</command> will check for a new version of 114 itself whenever it's run. Since domain name resolution is not yet configured 115 in the LFS chroot environment, <command>pip3</command> cannot check 116 for a new version of itself, and will 117 produce a warning. </para> 118 119 <para>After we boot the LFS system and set up a network connection, 120 a different warning will be issued, telling the user to update <command>pip3</command> 121 from a pre-built wheel on PyPI (whenever a new version is available). But LFS 122 considers <command>pip3</command> to be a part of Python 3, so it should not be 123 updated separately. Also, an update from a pre-built wheel would deviate 124 from our objective: to build a Linux system from source code. So the 125 warning about a new version of <command>pip3</command> should be ignored as 126 well. If you wish, you can suppress all these warnings by running the following 127 command, which creates a configuration file:</para> 118 128 119 129 <screen><userinput remap="install">cat > /etc/pip.conf << EOF … … 131 141 <para> 132 142 In LFS and BLFS we normally build and install Python modules with the 133 <command>pip3</command> command. Please take care that the134 <command>pip3 install</command> commands in both the books should be135 run as the &root; user unless it's for a Python virtual environment.136 Running a<command>pip3 install</command> as a non-&root; user may seem137 to work fine, but it will cause the installed module to be inaccessible143 <command>pip3</command> command. Please be sure that the 144 <command>pip3 install</command> commands in both books are 145 run as the &root; user (unless it's for a Python virtual environment). 146 Running <command>pip3 install</command> as a non-&root; user may seem 147 to work, but it will cause the installed module to be inaccessible 138 148 by other users. 139 149 </para> … … 141 151 <para> 142 152 <command>pip3 install</command> will not reinstall an already installed 143 module by default. Forusing the <command>pip3 install</command>153 module automatically. When using the <command>pip3 install</command> 144 154 command to upgrade a module (for example, from meson-0.61.3 to 145 155 meson-0.62.0), insert the option <parameter>--upgrade</parameter> into 146 the command line. If it's really necessary to downgrade a module or156 the command line. If it's really necessary to downgrade a module, or 147 157 reinstall the same version for some reason, insert 148 158 <parameter>--force-reinstall --no-deps</parameter> into the command … … 168 178 <listitem> 169 179 <para>Ensure the installed files have the correct ownership and 170 permissions. Without these options, using<application>tar</application>180 permissions. Without these options, <application>tar</application> 171 181 will install the package files with the upstream creator's values. 172 182 </para> … … 227 237 is a wrapper script that opens a <application>Python</application> 228 238 aware GUI editor. For this script to run, you must have installed 229 <application>Tk</application> before Python so that the Tkinter230 Python module is built 239 <application>Tk</application> before Python, so that the Tkinter 240 Python module is built. 231 241 </para> 232 242 <indexterm zone="ch-system-Python"> … … 241 251 <para> 242 252 The package installer for Python. You can use pip to install 243 packages from Python Package Index and other indexes 253 packages from Python Package Index and other indexes. 244 254 </para> 245 255 <indexterm zone="ch-system-Python"> … … 265 275 <listitem> 266 276 <para> 267 is an interpreted, interactive, object-oriented programming268 language277 is the interpreter for Python, an interpreted, interactive, 278 object-oriented programming language 269 279 </para> 270 280 <indexterm zone="ch-system-Python">
Note:
See TracChangeset
for help on using the changeset viewer.