Why does pip3 install in ~/.local on Debian?

The following warning in packaging.python.org may answer you questions

Warning Recent Debian/Ubuntu versions have modified pip to use the “User Scheme” by default, which is a significant behavior change that can be surprising to some users.


In Debian, pip3 defaults to the user scheme when run outside virtual envs, and files are installed under ~/.local.

If you want to install a tool system-wide using pip3 on Debian and derivatives, you can still use

pip3 install --system ...

to use the system scheme.

(It’s worth checking whether the tool in question is available as a Debian package; Debian 10 added many packages...)

As muru points out, virtual envs are a better approach in many cases. The whole topic of Python tool installation generates lots of discussion, even among core Python developers!