Ubuntu 16.04: can't open the terminal after trying to install Python












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!!










share|improve this question




















  • 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


















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!!










share|improve this question




















  • 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
















1












1








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!!










share|improve this question


















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!!







python gnome-terminal






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 15 '18 at 21:03







Carolina Iacovone

















asked Jan 15 '18 at 20:28









Carolina IacovoneCarolina Iacovone

63




63








  • 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
















  • 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










2




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





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







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




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







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




1





@CarolinaIacovone You'll probably need to reinstall Ubuntu then.

– wjandrea
Jan 16 '18 at 0:26





@CarolinaIacovone You'll probably need to reinstall Ubuntu then.

– wjandrea
Jan 16 '18 at 0:26




1




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







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












1 Answer
1






active

oldest

votes


















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))"






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f996318%2fubuntu-16-04-cant-open-the-terminal-after-trying-to-install-python%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    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))"






    share|improve this answer




























      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))"






      share|improve this answer


























        0












        0








        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))"






        share|improve this answer













        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))"







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 25 at 8:35









        Leon ChangLeon Chang

        1




        1






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f996318%2fubuntu-16-04-cant-open-the-terminal-after-trying-to-install-python%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents