Ubuntu – Manually Installed new Python to /usr/bin, how to get Repo version back

aptpythonpython-2.7

Yes, I'm a moron, and I tried to manually install a higher point release of python 2.7.16 to /usr/bin/ (i did ./configure --prefix=/usr) on my Ubuntu 16.04 machine. It seems to work fine EXCEPT for packages that depended on python, like apt-listchanges, which fails with messages like ImportError: No module named apt_pkg

there's no make uninstall available, I've tried manually removing files, and still when I try apt --reinstall install python, Nothing gets overwritten and the python executable still gives the new 2.7.16 version…

Any idea how to get the official repository version back??

Best Answer

To find out which package installed a file you can use apt-file, you can install it with

sudo apt install apt-file

and find the package with

apt-file search /path/to/file

so in this case

apt-file search /usr/bin/python

which revealed python2.7-minimal, reinstalling this package solved the problem, in this case OP reinstalled some other packages as well to be sure everything works fine:

apt --reinstall install libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-minimal python2.7 python2.7-minimal  
Related Question