From 29a37b45648c0163e54c50982d82ac6f6e9542c4 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Sun, 17 Apr 2022 12:55:48 -0500 Subject: [PATCH] Suppress a waring if running pip3 as root. In serveral places we use the pip3 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 pip3 as the root user. This change shows users how to avoid this warning. --- chapter08/python.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/chapter08/python.xml b/chapter08/python.xml index 6b12d3559..76530d782 100644 --- a/chapter08/python.xml +++ b/chapter08/python.xml @@ -92,6 +92,18 @@ make install + In serveral places we use the pip3 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 pip3 as the root user. If desired, + supress this warning by running the following command: + +sed -e '/def warn_if_run_as_root/a\ return' \ + -i /usr/lib/python3.10/site-packages/pip/_internal/cli/req_command.py + + + If desired, install the preformatted documentation: install -v -dm755 /usr/share/doc/python-&python-version;/html