Please I accidently removed python3.8 file from /usr/bin how can I restore it [duplicate]

I know I shouldn't do that but I was pissed at pip not detecting my installation.

I know apt and apt-get didn't work properly now so apt-get --fix-missing failed

Is it possible to reinstall python with reinstalling ubuntu?


Solution 1:

You could download the deb files from pkgs.org, open it with an archive manager and unpack the folders /usr/lib/python and /usr/lib/python3 from those files.

You need libpython and libpython-stdlib For 64bit, python2.7 and ubuntu 18.04 this would be libpython and libpython-stdlib. For other versions you need to find the packages with pkgs.org as said earlier.

The debs contain a file called data.xz. When installing, this file is unpacked. Go to usr/lib in that file. (In some archive managers ./usr/lib) From there you unpack the python folder to your /usr/lib and python should work again.