1

Yesterday I installed Ubuntu, but now I cannot open Terminal... I click on the Terminal icon and it doesn't start, and ctrl+alt+t isn't working either.

I've read different ways to fix this (and none of them worked) One way was to open XTerm and type gnome-terminal. When I did that I got this output:

Could not find platform independent libraries < prefix >
Could not find platform dependent libraries < exec_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 0x00007f54f2451700 (most recent call first):
Aborted (core dumped)

Today I tried to install Python and it didn't work for some reason... maybe that caused some problem?

Another way that I read was to change the language and locale (I'm from Argentina)... but I have just found that Language Support doesn't open either!!

9
  • 2
    When you "tried to install Python", what exactly did you do? Ubuntu has Python installed by default, and many applications, including, iirc, GNOME terminal, depend on it – Zanna Jan 15 '18 at 20:34
  • I downloaded and installed Anaconda following the instructions, so then I would have Jupyter Notebook. Everything was great during the installation, but when I typed "pip3 install --upgrade pip" failed because of some files of a folder "python3.5" Then, I typed "pip3 install jupyter" and failed too with the same folder. Then I stopped trying – Carolina Iacovone Jan 15 '18 at 20:56
  • 1
    Perhaps try to re-install gnome-terminal from the Software Center? Either that, of do a CTRL+ALT+F1 and then sudo apt install gnome-terminal (or try sudo apt install -f gnome-terminal if that doesn't work). – Vanessa Deagan Jan 15 '18 at 22:56
  • 1
    @CarolinaIacovone You'll probably need to reinstall Ubuntu then. – wjandrea Jan 16 '18 at 0:26
  • 1
    For the sake of clarity/posterity, forcibly removing /var/lib/dpkg/lock is the absolute last thing you should do. (There are many warnings in the linked thread about that.) It has a high chance of breaking your system and it appears that's exactly what's happened in this case. I'm not sure if this is a direct result of the original issue or just tangential. – wjandrea Jul 31 '18 at 19:15
0

I had the same terminal problem after upgrading Python from 3.5 to 3.7. As noted, Python 3.5(m) comes preloaded in Ubuntu 16.04 and the executable is in /usr/bin whereas Python 3.7 is installed in /usr/local/lib. My XTerm showed:

dell:/usr/bin$ gnome-terminal 
bash: /usr/bin/gnome-terminal: /usr/bin/python3: bad interpreter: No such file or directory

Once I changed the first line of "gnome-terminal" from #!/usr/bin/python3 to #!/usr/bin/python3.5m, it was working. On the other hand, if I changed it to #!/usr/local/bin/python3.7, it encountered the following error:

dell:/usr/bin$ gnome-terminal
Traceback (most recent call last):
File "/usr/bin/gnome-terminal", line 9, in <module>
from gi.repository import GLib, Gio
ModuleNotFoundError: No module named 'gi'

This shows that ubuntu 16.04 gnomi-terminal is supported by Python 3.5, but not 3.7.

In your case, your error was "ImportError: No module named 'encodings'". I suppose your Python is 3.5 or earlier. I searched the Ubuntu16.04 gnome-terminal script, there is no such statement as "import encodings". As suggested, you might want to reinstall gnome-terminal. I am not familiar with Anaconda, but looks like the default installation of Anaconda2 includes Python 2.7 and Anaconda3 includes Python 3.7. For Python 3.5, you need to follow this instruction. So make sure your gnome-terminal Python script is supported by the installed Python version, to be sure, issue shell command "/usr/bin/python3 --version" or python3 -c "import sys; print('\n'.join(sys.path))"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.