0

My current python version is python 2.7 (python --version), However, I've accidentally removed python2.7 from /usr/lib/ so I cannot do anything and I see this error:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site

Any suggestion?

3
  • Does sudo apt install --reinstall python2.7 helps?
    – mook765
    Sep 16, 2018 at 13:04
  • 1
    If mook765's idea doesn't work and all you did was just delete the file (i.e., not completely remove the package), you can try to use an Ubuntu boot disk to get the executable and copy it back... If you use the same Ubuntu version, the executables should be similar. Alternatively, you can download the package manually from here and extract the file(s) you need.
    – Ray
    Sep 16, 2018 at 14:59
  • What @Ray says. Try @mook765's idea first; if that doesn't work, carefully note your python package version, then download and extract the missing files. Then reinstall python2.7, just to be sure.
    – Jos
    Sep 16, 2018 at 15:25

0

Browse other questions tagged .