Looking for ways to install #Python programs on #Debian 11 and 12 systems, globally (as would normally be in /usr/local/bin/ for executables, elsewhere in /usr/local/ for additional files), to run periodically or as daemons (later setting systemd services for those). "Easy install" is deprecated, pip points at the externally managed environment and wants a virtual environment, pipx also installs into a venv in the user's home directory. Executable scripts are available to other users then, but sitting in a user directory, which is unconventional, contrary to the FHS. Packaging into .deb must be possible, apparently using dh-python, though so far I have not found a complete guide to follow, possibly will have to dig deeper into it. Single-file scripts could be simply copied into /usr/local/bin/, but there can be multi-file programs as well. I wonder whether I am missing something: this looks surprisingly tricky for such a task, with a very popular language and a popular Linux distribution. How do you package and install custom Python programs on Debian?
@defanor pipx with global options (sudo PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install cowsay) would be easiest.
(I'd swap out /opt for /usr/local/lib.)
But yea, putting in the extra work to package a deb is nice if you're going to install on multiple systems. Like others suggested: apt-get source some other python package and adapt as needed.
@sedje Thanks, tried it out as well now. Fortunately packaging into a deb worked, but going to use this as a backup option.