Score:0

Python error on installing or updating

bf flag

when i typed the command: sudo apt update then its showing the problem listed below:

tom@boy:~$ sudo apt update
[sudo] password for tom: 
Hit:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease
Hit:2 http://packages.microsoft.com/repos/code stable InRelease                                                                                                                                           
Hit:3 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                                                                              
Hit:4 https://packages.microsoft.com/repos/vscode stable InRelease                                                                                                                                        
Hit:5 http://np.archive.ubuntu.com/ubuntu focal InRelease                                 
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease    
Hit:7 http://ppa.launchpad.net/sylvain-pineau/kazam/ubuntu focal InRelease
Hit:8 http://np.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:9 http://np.archive.ubuntu.com/ubuntu focal-backports InRelease
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 0x00007f135d32d740 (most recent call first):
<no Python frame>
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code

and when i typed the command sudo apt install something then its showing the problem shown below:

tom@boy:~$ sudo apt install wireshark
Reading package lists... Done
Building dependency tree       
Reading state information... Done
wireshark is already the newest version (3.2.3-1).
wireshark set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 219 not upgraded.
7 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up python2-minimal (2.7.17-2ubuntu4) ...
/var/lib/dpkg/info/python2-minimal.postinst: 4: python2.7: not found
dpkg: error processing package python2-minimal (--configure):
 installed python2-minimal package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:enter code here
 python2-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)
us flag
Did you change the default python version? If not, do you remember what you did before this error appeared? Also, do you need python2 (it is not installed by default on Ubuntu 20.04)? Try `sudo apt purge python2-minimal`.
karel avatar
sa flag
Does this answer your question? [Cannot install or uninstall with apt](https://askubuntu.com/questions/1215399/cannot-install-or-uninstall-with-apt)
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.