0

(This is not a duplicate of Accidentally deleted /usr/lib/python3.4, the errors I get are different.)

Today I accidentally deleted usr/lib/python3.4, now Ctrl+Alt+T is not working anymore, terminal and unity-tweak-tool are not opening from the app drawer.

I get this error while I try to open unity-tweak-tool from the terminal. How can I fix this?

Could not find platform independent libraries 
Could not find platform dependent libraries 
Consider setting $PYTHONHOME to [:]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

UPDATE
After running sudo apt install --reinstall $(dpkg -S /usr/lib/python3.* | sed -r 's/, /\n/g; s/\: .+//') it reinstalled some things but at the end it gave me another error: E: Internal Error, No file name for python3.4:amd64. After running unity-tweak-tool I now get:

Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Current thread 0x00007f06bc180700 (most recent call first):
(core dump created)
ZwartyZ
  • 101
  • 1
  • 3
  • Did you actually manage to fix this? It gave me the same error.. I don't want to reinstall ubuntu if possible.. – Kuntau May 22 '19 at 10:25

1 Answers1

1

Several Python packages keep their in there so reinstalling one might not do it. See what has files in there on your system by running:

dpkg -S /usr/lib/python3.4

That will return something slightly different for everybody but the important part is reinstalling the packages it shows.

It needs a bit of processing (removing commas, chopping off the path), but here's something that does all that and gets them reinstalled.

sudo apt install --reinstall $(dpkg -S /usr/lib/python3.* | sed -r 's/, /\n/g; s/\: .+//')

In some cases you might have to prioritise (install them first) some packages over others manually but see what you get.

Oli
  • 293,335