2

I can no longer install or remove any software using apt-get. When I try I get the error:

Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: can't initialize sys standard streams
ImportError: No module names 'io'

I tried to reinstall python but that just brings up this error again.

I'm running Raspbian.

Update from comments:
Here is the error log: https://pastebin.com/nXmRTx03
and pip install io gives me: https://pastebin.com/DtHqfc3n

Ingo
  • 42,107
  • 20
  • 85
  • 197

1 Answers1

1

As shown in the error log there seems to be a general problem with updates. Before trying anything else with python you should fix your update. You only do an sudo apt-get upgrade. Before doing it you should update the packages lists. So first try to do:

rpi ~$ sudo apt update
rpi ~$ sudo apt full-upgrade

and reboot. You should now have an up to date system. Check with:

rpi ~$ apt list --upgradable
Listing... Done

It should not show any upgradable packages. If this does not help then you can try to reinitialze the packet manager. How to do it you can look at Raspberry Pi sudo apt-get update not working.

If you have a clean updated system then you can try to use python.

Ingo
  • 42,107
  • 20
  • 85
  • 197