When installing python using deadsnakes ppa, and using pip on it like in the following example
python3.12 -m pip install django
will result in the following error
File "/usr/lib/python3/dist-packages/pip/_internal/locations/_distutils.py", line 9, in <module>
from distutils.cmd import Command as DistutilsCommand
ModuleNotFoundError: No module named 'distutils'
Run
sudo apt install python3.12-distutils
and this should solve your problem InshaAllah
When installing any python version using the deadsnakes ppa, you won't install an important package called distutils which is required for pip to run, if you have any other version other than python3.12, than use the following format
sudo apt install python{version}-distutils