Install pip with old python version?

I have some 3.10 python packages installed in ~/.local/lib/python3.10 which uses python 3.11.
To remove these packages neatly and automatically I was thinking of installing python 3.10 with pip.
Python 3.10 has been installed but how do I get the optional dependency pip installed.

I already have pip installed in /usr/lib/python3.11/site-packages/pip

But I can not use it with “python3.10 -m pip”. I think it is because it does not reside in “usr/lib/python3.10/site-packages/pip”.

Is the only way to solve the issue by looking in the RECORD file for each package and remove the files manully or is there a way to install pip for 3.10?

You don’t need to install something to uninstall something. You could simply remove the old directory.

And for the future, use pyenv for managing user versions and environments.


Looking in the different RECORD files there are some files that are not installed in the directory so deleting the directory will not remove them.

Is there a way to install pip on the python3.10 install. I was thinking of doing a hardlink to the pip in 3.11 since the pip is compatible between 3.11 and 3.10, but I do not know if it would screw up something.

About pyenv. I was thinking I would like to skip learning an other tool to just remove the old packages if possible. Since I seldom use python packages. But if it is necessary I will look in on it.