Raspberry Pi: Fatal Python error: initsite: Failed to import the site module
With no system changes, just a reboot, my raspberry pi (buster) python 3.7 installation does this when the python3 command is run:
Traceback (most recent call last):
File "/usr/lib/python3.7/site.py", line 603, in <module>
main()
File "/usr/lib/python3.7/site.py", line 590, in main
known_paths = addsitepackages(known_paths)
File "/usr/lib/python3.7/site.py", line 366, in addsitepackages
addsitedir(sitedir, known_paths)
File "/usr/lib/python3.7/site.py", line 213, in addsitedir
addpackage(sitedir, name, known_paths)
File "/usr/lib/python3.7/site.py", line 169, in addpackage
for n, line in enumerate(f):
File "/usr/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 342: invalid continuation byte
I’m unable to uninstall python using apt-get because that same error gets thrown partway through the uninstall process.
Any idea how to fix the error, or remove python so I can re-install it?
Read more here: Source link