diff options
Diffstat (limited to 'chapter08/python.xml')
-rw-r--r-- | chapter08/python.xml | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/chapter08/python.xml b/chapter08/python.xml index 76530d782..b7f2da6b9 100644 --- a/chapter08/python.xml +++ b/chapter08/python.xml @@ -93,16 +93,43 @@ <screen><userinput remap="install">make install</userinput></screen> <para>In serveral places we use the <command>pip3</command> command to - install Python 3 programs and modules for all users as root. This conflicts - with the Python developers recommendation to build packages in a virtual - environment as a regular user. To this end, a multi-line warning is - written when using <command>pip3</command> as the root user. If desired, - supress this warning by running the following command:</para> + install Python 3 programs and modules for all users as + <systemitem class='username'>root</systemitem>. This conflicts + with the Python developers recommendation to install packages into a + virtual environment or the home directory of a regular user (by running + <command>pip3</command> as this user). To this end, a multi-line warning + is written when using <command>pip3</command> as the + <systemitem class='username'>root</systemitem> user. The main reason + of this recommendation is for avoiding a conflict with the system + package manager (<command>dpkg</command> for example), but LFS does not + have a system-wide package manager so this is not a problem. If desired, + suppress this warning by running the following command:</para> <screen><userinput remap="install">sed -e '/def warn_if_run_as_root/a\ return' \ -i /usr/lib/python3.10/site-packages/pip/_internal/cli/req_command.py </userinput></screen> + <important> + <para> + In LFS and BLFS we normally build and install Python modules with the + <command>pip3</command> command. Please take care that the + <command>pip3 install</command> commands in both the books should be + run as the &root; user unless it's for a Python virtual environment. + Running a <command>pip3 install</command> as a non-&root; user may seem + to work fine, but it will cause the installed module to be inaccessible + by other users. + </para> + + <para> + <command>pip3 install</command> will not reinstall an already installed + module by default. For using the <command>pip3 install</command> + command to upgrade a module (for example, from meson-0.61.3 to + meson-0.62.0), insert the option <parameter>--upgrade</parameter> into + the command line. If it's really necessary to downgrade a module or + reinstall the same version for some reason, insert + <parameter>--force-reinstall</parameter> into the command line. + </para> + </important> <para>If desired, install the preformatted documentation:</para> |