Score:0

I accidently deleted /lib/python3.8

us flag

I deleted /lib/python3.8 and now I can't use gnome-terminal, apt, python3 itself and couple of other programs. I was trying to free up space with bleach-bit and manually. Then I saw a 2 folders, both python3 (python3.8 and python3.9) in /usr/lib/ directory. So I deleted the old one but it was actually linked to the default python3 (I didn't knew). Now I have python3.9 but I think python3.9 is not fully installed. I can't use apt anymore because of this:

user@~> sudo apt reinstall python3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
Need to get 0 B/47.6 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 321097 files and directories currently installed.)
Preparing to unpack .../python3_3.8.2-0ubuntu2_amd64.deb ...
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/usr/bin/python3'
  isolated = 0
  environment = 1

(...)

Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f52786bb740 (most recent call first):
<no Python frame>
dpkg: error while cleaning up:
 installed python3 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/python3_3.8.2-0ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

One more thing I also did 'apt remove python3-tk' (In case it might help). I really don't wanna reinstall Ubuntu cause it would be my 7th time I do it and I don't have Ubuntu 20.04 media right now. If there is no solution possible other than reinstalling please provide me the /usr/lib/python3.8 folder. I tried solution in here but it gave me 4 'errors were encountered' packages (python3, python3-lib2to3, python3-distutils, python3-gdbm:amd64 and gnome-menus) instead of 2 (python3 and python3-tk (it was only python3 after I deleted python3-tk)). I linked /usr/bin/python to python2.7 to avoid further problems.

ar flag
Don't mess with python. It is needed for the system to work.
user535733 avatar
cn flag
You have discovered why we don't recommend the use of BleachBit on Ubuntu systems. Based upon your continuing chain of unwise actions ("*I linked /usr/bin/python to python2.7*"), your 7th install will be merely the latest. There will be more.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.