Score:0

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

ru flag

this is the error I get when install python3.8 or running python

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
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python3'
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.executable = '/usr/bin/python3'
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python38.zip',
    '/usr/lib/python3.8',
    '/usr/lib/lib-dynload',
  ]
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 0x00007f6b1e8a6740 (most recent call first):
<no Python frame>
dpkg: error processing package python3-webencodings (--configure):
 installed python3-webencodings package post-installation script subprocess returned error exit status 1
Setting up python3-psutil (5.5.1-1ubuntu4) ...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_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
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python3'
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.executable = '/usr/bin/python3'
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python38.zip',
    '/usr/lib/python3.8',
    '/usr/lib/lib-dynload',
  ]
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 0x00007fb94be12740 (most recent call first):
<no Python frame>
dpkg: error processing package python3-psutil (--configure):
 installed python3-psutil package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of resetter:
 resetter depends on python3-psutil (>= 3.4.1); however:
  Package python3-psutil is not configured yet.

dpkg: error processing package resetter (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of python3-html5lib:
 python3-html5lib depends on python3-webencodings; however:
  Package python3-webencodings is not configured yet.

dpkg: error processing package python3-html5lib (--configure):
 dependency problems - leaving unconfigured
Setting up python3-lxml:amd64 (4.5.0-1ubuntu0.3) ...
No apport report written because MaxReports is reached already
                                                              Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_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
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python3'
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.executable = '/usr/bin/python3'
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python38.zip',
    '/usr/lib/python3.8',
    '/usr/lib/lib-dynload',
  ]
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 0x00007f4941806740 (most recent call first):
<no Python frame>
dpkg: error processing package python3-lxml:amd64 (--configure):
 installed python3-lxml:amd64 package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Setting up python3-soupsieve (1.9.5+dfsg-1) ...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_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
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python3'
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.executable = '/usr/bin/python3'
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python38.zip',
    '/usr/lib/python3.8',
    '/usr/lib/lib-dynload',
  ]
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 0x00007f59b8207740 (most recent call first):
<no Python frame>
dpkg: error processing package python3-soupsieve (--configure):
 installed python3-soupsieve package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of python3-bs4:
 python3-bs4 depends on python3-soupsieve; however:
  Package python3-soupsieve is not configured yet.

dpkg: error processing package python3-bs4 (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 python3-webencodings
 python3-psutil
 resetter
 python3-html5lib
 python3-lxml:amd64
 python3-soupsieve
 python3-bs4
E: Sub-process /usr/bin/dpkg returned an error code (1) 
ru flag
Reinstall your OS. There's no way to recover from removing the Python executable from the system without a TON of work and an external medium
us flag
I am not very sure if it would work, but if you have a Ubuntu installation media, you can copy the necessary files from `/usr/bin` as root.
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.