The Python module packages add useful objects to the Python language. Modules utilized by packages throughout SLFS are listed here, along with their dependencies.
In BLFS and SLFS, we normally build and install Python 3 modules
with pip3. Please
take care that the pip3
install commands in the book should be run as
root
unless it's for a Python
virtual environment. Running pip3
install as a non-root
user may seem to work fine, but it will
cause the installed module to be inaccessible by other users.
pip3 install will
not reinstall an already installed module by default. For using
the pip3 install
command to upgrade a module (for example, from meson-0.61.3 to
meson-0.62.0), insert --upgrade
into the command line. If
it's really necessary to downgrade a module or reinstall the same
version for some reason, insert --force-reinstall
into the command
line.
The nvchecker module provides a solution for checking versions of packages. Arch Linux and other teams rely on this module for checking for updates to provide the latest software to their users.
Recommended patch for updcheck from lfs-tools: https://github.com/glfs-book/lfs-tools/raw/refs/heads/trunk/updcheck/nvchecker.diff
platformdirs-4.4.0, pycurl-7.45.6, structlog-25.4.0, and tornado-6.5.2
Git, libnotify, PyGObject, and toml-0.10.2
If you downloaded the recommended patch, apply it now:
patch -Np1 -i ../nvchecker.diff
Build the module:
pip3 wheel -w dist --no-build-isolation --no-deps --no-cache-dir $PWD
Now, as the root
user:
pip3 install --no-index --find-links=dist --no-cache-dir --no-user nvchecker
-w dist
: Bygger det
passende «wheel» for denne modulen i mappen
dist
.
--no-build-isolation
:
Forteller at pip3
skal kjøre byggingen i systemmiljøet i stedet for å opprette et
midlertidig byggemiljø.
--no-deps
: Forhindrer
pip3 fra å bygge
wheels for prosjektets avhengigheter.
--no-index
: Ignorerer
pakkeindeksen (ser bare på --find-links
URL-er i stedet).
--find-links dist
: Søker
etter lenker til arkiver som for eksempel wheel (.whl
) filer i mappen dist
.
--no-cache-dir
:
Deaktiverer hurtigbufferen for å forhindre en advarsel ved
installasjon som root
bruker.
--no-user
: Forhindre at
du feilaktig kjører install kommandoen som en ikke-root bruker.
--upgrade
: Oppgrader pakken til den
nyeste tilgjengelige versjonen. Dette alternativet brukes med
install kommandoen hvis en versjon av pakken allerede er
installert.
--force-reinstall
: Installer pakken
på nytt selv om den er oppdatert. Dette alternativet brukes med
install kommandoen hvis du installerer pakken på nytt eller går
tilbake til en tidligere versjon av pakken.
--no-deps
: Ikke installer
pakkeavhengigheter. Dette alternativet kan være nødvendig med
--upgrade
eller --force-reinstall
alternativene.