How to uninstall a python version which was installed from source (Ubuntu)?

1.3k Views Asked by At

I'm on Ubuntu 22.04.1 which comes whit its own python3.11 and have just installed an alternative python version (3.7.9 ) from source (I'm not able to use apt for this python version), doing the following

cd usr/lib
sudo wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
sudo tar xzf Python-3.7.9.tg
cd Python-3.7.9
sudo ./configure --enable-optimizations
sudo make altinstall

The executable (python3.7 file) was correctly installed in /usr/local/bin (I found this path running which python3.7), where also other files were installed (es. 2to3-3.7; easy_install-3.7 ; idle3.7; pip3.7 ; pydoc3.7; python3.7m-config; python3.7m; pyvenv-3.7). A file called python3.7 was also installed in /usr/local/lib. Of course there is also a file called python3.7.9 in /urs/lib. Sincerely I don't know if other files were installed and were.

I want to delete this python installation: do I have to do it manually or there exists a simpler way? I would add that I don't have a make uninstall option. I also tried make clean and make distclean but nothing happened (the above-mentioned files are still present and python3.7 is still working).

If there isn't an intelligent way to uninstall, is it sufficient to manually delete python3.7 related files from /usr/local/bin, /usr/local/lib, /urs/lib or am I missing something?

Thanks

0

There are 0 best solutions below