My python 2 and 3 interpreters in /usr/bin somehow got deleted and now I am unable to reinstall either. I see that similar questions have been asked earlier(I accidentally deleted /usr/bin/python. How do I restore it?) but trying to reinstall using
sudo apt-get install --reinstall python2.7 fails with the following message, and a list of about 15 packages:
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
When I run
sudo apt --fix-broken install it fails with the following error message:
Could not find platform independent libraries <prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] /usr/bin/python2.7: can't open file '/usr/lib/python2.7/py_compile.py': [Errno 2] No such file or directory dpkg: error processing package python2.7-minimal (--configure): installed python2.7-minimal package post-installation script subprocess returned error exit status 2 dpkg: dependency problems prevent configuration of python-minimal: python-minimal depends on python2.7-minimal (>= 2.7.15~rc1-1~); however: Package python2.7-minimal is not configured yet. dpkg: error processing package python-minimal (--configure): dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure. Errors were encountered while processing: python2.7-minimal python-minimal E: Sub-process /usr/bin/dpkg returned an error code (1)
This happens despite setting
/usr/lib, prior to running the above command.
Trying to reinstall python2.7-minimal first also produces the same errors.