Python2.7 not working in 18.04, python3 is installed

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












6














I have installed ubuntu 18.04 in virtual box and when trying python -v, it says you have python3 installed, I want to remove python 3 or disable so that can use python2.7 and run some scripts i have.










share|improve this question























  • @karel: thanks for the info. I checked again with a live system and found that it is also not installed in 18.10.
    – Takkat
    Dec 25 '18 at 16:15










  • @karel Thank you. Close vote retracted and previous comments redacted :) +1 for your answer as well :)
    – WinEunuuchs2Unix
    Dec 25 '18 at 16:38







  • 3




    FYI: Python 2 will lose upstream support in a little over a year, so you should make plans to either fork Python or migrate to Python 3 soon.
    – Kevin
    Dec 25 '18 at 17:40











  • @Rahul Use python2 or python3 instead of just python, because in some systems (Arch for example) python without version runs Python 3 by default (I think Ubuntu will do the same at some point). Agreeing with Kevin, you should migrate to 3.x (as of late 2018, there are only a few 2.x-only libraries)
    – trolley813
    Dec 28 '18 at 7:43















6














I have installed ubuntu 18.04 in virtual box and when trying python -v, it says you have python3 installed, I want to remove python 3 or disable so that can use python2.7 and run some scripts i have.










share|improve this question























  • @karel: thanks for the info. I checked again with a live system and found that it is also not installed in 18.10.
    – Takkat
    Dec 25 '18 at 16:15










  • @karel Thank you. Close vote retracted and previous comments redacted :) +1 for your answer as well :)
    – WinEunuuchs2Unix
    Dec 25 '18 at 16:38







  • 3




    FYI: Python 2 will lose upstream support in a little over a year, so you should make plans to either fork Python or migrate to Python 3 soon.
    – Kevin
    Dec 25 '18 at 17:40











  • @Rahul Use python2 or python3 instead of just python, because in some systems (Arch for example) python without version runs Python 3 by default (I think Ubuntu will do the same at some point). Agreeing with Kevin, you should migrate to 3.x (as of late 2018, there are only a few 2.x-only libraries)
    – trolley813
    Dec 28 '18 at 7:43













6












6








6


2





I have installed ubuntu 18.04 in virtual box and when trying python -v, it says you have python3 installed, I want to remove python 3 or disable so that can use python2.7 and run some scripts i have.










share|improve this question















I have installed ubuntu 18.04 in virtual box and when trying python -v, it says you have python3 installed, I want to remove python 3 or disable so that can use python2.7 and run some scripts i have.







18.04 virtualbox python






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 25 '18 at 9:37









mature

1,675523




1,675523










asked Dec 25 '18 at 8:18









Rahul

364




364











  • @karel: thanks for the info. I checked again with a live system and found that it is also not installed in 18.10.
    – Takkat
    Dec 25 '18 at 16:15










  • @karel Thank you. Close vote retracted and previous comments redacted :) +1 for your answer as well :)
    – WinEunuuchs2Unix
    Dec 25 '18 at 16:38







  • 3




    FYI: Python 2 will lose upstream support in a little over a year, so you should make plans to either fork Python or migrate to Python 3 soon.
    – Kevin
    Dec 25 '18 at 17:40











  • @Rahul Use python2 or python3 instead of just python, because in some systems (Arch for example) python without version runs Python 3 by default (I think Ubuntu will do the same at some point). Agreeing with Kevin, you should migrate to 3.x (as of late 2018, there are only a few 2.x-only libraries)
    – trolley813
    Dec 28 '18 at 7:43
















  • @karel: thanks for the info. I checked again with a live system and found that it is also not installed in 18.10.
    – Takkat
    Dec 25 '18 at 16:15










  • @karel Thank you. Close vote retracted and previous comments redacted :) +1 for your answer as well :)
    – WinEunuuchs2Unix
    Dec 25 '18 at 16:38







  • 3




    FYI: Python 2 will lose upstream support in a little over a year, so you should make plans to either fork Python or migrate to Python 3 soon.
    – Kevin
    Dec 25 '18 at 17:40











  • @Rahul Use python2 or python3 instead of just python, because in some systems (Arch for example) python without version runs Python 3 by default (I think Ubuntu will do the same at some point). Agreeing with Kevin, you should migrate to 3.x (as of late 2018, there are only a few 2.x-only libraries)
    – trolley813
    Dec 28 '18 at 7:43















@karel: thanks for the info. I checked again with a live system and found that it is also not installed in 18.10.
– Takkat
Dec 25 '18 at 16:15




@karel: thanks for the info. I checked again with a live system and found that it is also not installed in 18.10.
– Takkat
Dec 25 '18 at 16:15












@karel Thank you. Close vote retracted and previous comments redacted :) +1 for your answer as well :)
– WinEunuuchs2Unix
Dec 25 '18 at 16:38





@karel Thank you. Close vote retracted and previous comments redacted :) +1 for your answer as well :)
– WinEunuuchs2Unix
Dec 25 '18 at 16:38





3




3




FYI: Python 2 will lose upstream support in a little over a year, so you should make plans to either fork Python or migrate to Python 3 soon.
– Kevin
Dec 25 '18 at 17:40





FYI: Python 2 will lose upstream support in a little over a year, so you should make plans to either fork Python or migrate to Python 3 soon.
– Kevin
Dec 25 '18 at 17:40













@Rahul Use python2 or python3 instead of just python, because in some systems (Arch for example) python without version runs Python 3 by default (I think Ubuntu will do the same at some point). Agreeing with Kevin, you should migrate to 3.x (as of late 2018, there are only a few 2.x-only libraries)
– trolley813
Dec 28 '18 at 7:43




@Rahul Use python2 or python3 instead of just python, because in some systems (Arch for example) python without version runs Python 3 by default (I think Ubuntu will do the same at some point). Agreeing with Kevin, you should migrate to 3.x (as of late 2018, there are only a few 2.x-only libraries)
– trolley813
Dec 28 '18 at 7:43










5 Answers
5






active

oldest

votes


















16














Python 2 is no longer installed by default in fresh installations of Ubuntu 18.04 and later. Don't remove python3 from Ubuntu 18.04 and later or else Ubuntu Software, the terminal and many other apps that are installed by default will stop working. If you removed Python 3 and now Ubuntu Software, terminal and other applications don't work follow the instructions in this answer to reinstall it and get all applications working again.



To install Python 2.7 in Ubuntu 18.04 and later open the terminal and type:



sudo apt install python2.7 


To start the Python 2.7 interpreter run this command:



python2.7


To start the Python 3 interpreter run this command:



python3 


Either way the Python interpreter will show a version message when it is started that shows what version of Python you are running.






share|improve this answer






























    6














    In Ubuntu 18.04 LTS both Python 2.7, and Python 3 are installed by default:



    enter image description here
    Screenhot from live session



    In 18.10. and in 19.04 it will not be installed in a live session:



    enter image description here



    You will have to intall Python 2.7 manually before you can use it.



    sudo apt install python


    Applications depending on it will install it as a dependency.






    share|improve this answer






























      2














      1) To install Python 2 version on Ubuntu 18.04 open up terminal and enter:



      sudo apt install python-minimal


      or



      sudo apt install python2.7


      Check version:



      python --version




      2) If still python 3+ updated list of Python alternatives to perform a switch between any python version is to run:



      update-alternatives --config python


      Example:



      There are 2 choices for the alternative python (providing /usr/bin/python).

      Selection Path Priority Status
      ------------------------------------------------------------
      * 0 /usr/bin/python3.5 2 auto mode
      1 /usr/bin/python2.7 1 manual mode
      2 /usr/bin/python3.5 2 manual mode

      Press <enter> to keep the current choice[*], or type selection number: 1
      update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in manual mode


      and select an appropriate version using selction integer as shown above.





      3) If you see: update-alternatives: error: no alternatives for python. Run:



      ls /usr/bin/python*


      Example output:



      /usr/bin/python /usr/bin/python2 /usr/bin/python2.7 /usr/bin/python3 /usr/bin/python3.5


      Next, update the Python alternatives list for each version you whish to use with priority 1 and 2:



      update-alternatives --install /usr/bin/python python /usr/bin/python3.5 1
      update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2


      Then run again update-alternatives --config python and select an appropriate version..






      share|improve this answer






















      • Could you please clarify what exactly is last two commands are doing here, One more question is i changed in my script from #!/usr/bin/python to #!/usr/bin/python2.7. Is it possible to change the env path for python2.7 to /usr/bin/python
        – Rahul
        Dec 25 '18 at 8:52










      • @Rahul When you use python as a command on terminal the alternatives/aliases are considered. But in scripts as you are the absolute path of python so you need to use the path of python version you want to use.
        – Kulfy
        Dec 25 '18 at 8:56










      • @Rahul, sorry fixed. In this commands you set priority in last numeric params (2 and 1).
        – mature
        Dec 25 '18 at 9:16


















      1














      You don't need to remove or disable python3 on your Ubuntu.



      If you just need python to run small scripts, you can simply install Python 2 as @karel's answer.



      If you start learning Python, I suggest you to use virtual environment or conda






      share|improve this answer




















      • yes got it now, installed python2.7 and checked whereis python2.7 and made script using that env.. Thanks
        – Rahul
        Dec 25 '18 at 8:39










      • Usually, I don't install package from conda, I install package by pip. I just use conda to create global access virtual env.
        – thangdc94
        Dec 25 '18 at 9:37


















      1














      No need to disable python 3. You can execute python 2.7 using command python2 filename.py.
      You can check python 2 version by python2 --version






      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%2f1104397%2fpython2-7-not-working-in-18-04-python3-is-installed%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        16














        Python 2 is no longer installed by default in fresh installations of Ubuntu 18.04 and later. Don't remove python3 from Ubuntu 18.04 and later or else Ubuntu Software, the terminal and many other apps that are installed by default will stop working. If you removed Python 3 and now Ubuntu Software, terminal and other applications don't work follow the instructions in this answer to reinstall it and get all applications working again.



        To install Python 2.7 in Ubuntu 18.04 and later open the terminal and type:



        sudo apt install python2.7 


        To start the Python 2.7 interpreter run this command:



        python2.7


        To start the Python 3 interpreter run this command:



        python3 


        Either way the Python interpreter will show a version message when it is started that shows what version of Python you are running.






        share|improve this answer



























          16














          Python 2 is no longer installed by default in fresh installations of Ubuntu 18.04 and later. Don't remove python3 from Ubuntu 18.04 and later or else Ubuntu Software, the terminal and many other apps that are installed by default will stop working. If you removed Python 3 and now Ubuntu Software, terminal and other applications don't work follow the instructions in this answer to reinstall it and get all applications working again.



          To install Python 2.7 in Ubuntu 18.04 and later open the terminal and type:



          sudo apt install python2.7 


          To start the Python 2.7 interpreter run this command:



          python2.7


          To start the Python 3 interpreter run this command:



          python3 


          Either way the Python interpreter will show a version message when it is started that shows what version of Python you are running.






          share|improve this answer

























            16












            16








            16






            Python 2 is no longer installed by default in fresh installations of Ubuntu 18.04 and later. Don't remove python3 from Ubuntu 18.04 and later or else Ubuntu Software, the terminal and many other apps that are installed by default will stop working. If you removed Python 3 and now Ubuntu Software, terminal and other applications don't work follow the instructions in this answer to reinstall it and get all applications working again.



            To install Python 2.7 in Ubuntu 18.04 and later open the terminal and type:



            sudo apt install python2.7 


            To start the Python 2.7 interpreter run this command:



            python2.7


            To start the Python 3 interpreter run this command:



            python3 


            Either way the Python interpreter will show a version message when it is started that shows what version of Python you are running.






            share|improve this answer














            Python 2 is no longer installed by default in fresh installations of Ubuntu 18.04 and later. Don't remove python3 from Ubuntu 18.04 and later or else Ubuntu Software, the terminal and many other apps that are installed by default will stop working. If you removed Python 3 and now Ubuntu Software, terminal and other applications don't work follow the instructions in this answer to reinstall it and get all applications working again.



            To install Python 2.7 in Ubuntu 18.04 and later open the terminal and type:



            sudo apt install python2.7 


            To start the Python 2.7 interpreter run this command:



            python2.7


            To start the Python 3 interpreter run this command:



            python3 


            Either way the Python interpreter will show a version message when it is started that shows what version of Python you are running.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 25 '18 at 16:17

























            answered Dec 25 '18 at 8:24









            karel

            57.5k12127146




            57.5k12127146























                6














                In Ubuntu 18.04 LTS both Python 2.7, and Python 3 are installed by default:



                enter image description here
                Screenhot from live session



                In 18.10. and in 19.04 it will not be installed in a live session:



                enter image description here



                You will have to intall Python 2.7 manually before you can use it.



                sudo apt install python


                Applications depending on it will install it as a dependency.






                share|improve this answer



























                  6














                  In Ubuntu 18.04 LTS both Python 2.7, and Python 3 are installed by default:



                  enter image description here
                  Screenhot from live session



                  In 18.10. and in 19.04 it will not be installed in a live session:



                  enter image description here



                  You will have to intall Python 2.7 manually before you can use it.



                  sudo apt install python


                  Applications depending on it will install it as a dependency.






                  share|improve this answer

























                    6












                    6








                    6






                    In Ubuntu 18.04 LTS both Python 2.7, and Python 3 are installed by default:



                    enter image description here
                    Screenhot from live session



                    In 18.10. and in 19.04 it will not be installed in a live session:



                    enter image description here



                    You will have to intall Python 2.7 manually before you can use it.



                    sudo apt install python


                    Applications depending on it will install it as a dependency.






                    share|improve this answer














                    In Ubuntu 18.04 LTS both Python 2.7, and Python 3 are installed by default:



                    enter image description here
                    Screenhot from live session



                    In 18.10. and in 19.04 it will not be installed in a live session:



                    enter image description here



                    You will have to intall Python 2.7 manually before you can use it.



                    sudo apt install python


                    Applications depending on it will install it as a dependency.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Dec 25 '18 at 16:21

























                    answered Dec 25 '18 at 15:27









                    Takkat

                    106k35249375




                    106k35249375





















                        2














                        1) To install Python 2 version on Ubuntu 18.04 open up terminal and enter:



                        sudo apt install python-minimal


                        or



                        sudo apt install python2.7


                        Check version:



                        python --version




                        2) If still python 3+ updated list of Python alternatives to perform a switch between any python version is to run:



                        update-alternatives --config python


                        Example:



                        There are 2 choices for the alternative python (providing /usr/bin/python).

                        Selection Path Priority Status
                        ------------------------------------------------------------
                        * 0 /usr/bin/python3.5 2 auto mode
                        1 /usr/bin/python2.7 1 manual mode
                        2 /usr/bin/python3.5 2 manual mode

                        Press <enter> to keep the current choice[*], or type selection number: 1
                        update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in manual mode


                        and select an appropriate version using selction integer as shown above.





                        3) If you see: update-alternatives: error: no alternatives for python. Run:



                        ls /usr/bin/python*


                        Example output:



                        /usr/bin/python /usr/bin/python2 /usr/bin/python2.7 /usr/bin/python3 /usr/bin/python3.5


                        Next, update the Python alternatives list for each version you whish to use with priority 1 and 2:



                        update-alternatives --install /usr/bin/python python /usr/bin/python3.5 1
                        update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2


                        Then run again update-alternatives --config python and select an appropriate version..






                        share|improve this answer






















                        • Could you please clarify what exactly is last two commands are doing here, One more question is i changed in my script from #!/usr/bin/python to #!/usr/bin/python2.7. Is it possible to change the env path for python2.7 to /usr/bin/python
                          – Rahul
                          Dec 25 '18 at 8:52










                        • @Rahul When you use python as a command on terminal the alternatives/aliases are considered. But in scripts as you are the absolute path of python so you need to use the path of python version you want to use.
                          – Kulfy
                          Dec 25 '18 at 8:56










                        • @Rahul, sorry fixed. In this commands you set priority in last numeric params (2 and 1).
                          – mature
                          Dec 25 '18 at 9:16















                        2














                        1) To install Python 2 version on Ubuntu 18.04 open up terminal and enter:



                        sudo apt install python-minimal


                        or



                        sudo apt install python2.7


                        Check version:



                        python --version




                        2) If still python 3+ updated list of Python alternatives to perform a switch between any python version is to run:



                        update-alternatives --config python


                        Example:



                        There are 2 choices for the alternative python (providing /usr/bin/python).

                        Selection Path Priority Status
                        ------------------------------------------------------------
                        * 0 /usr/bin/python3.5 2 auto mode
                        1 /usr/bin/python2.7 1 manual mode
                        2 /usr/bin/python3.5 2 manual mode

                        Press <enter> to keep the current choice[*], or type selection number: 1
                        update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in manual mode


                        and select an appropriate version using selction integer as shown above.





                        3) If you see: update-alternatives: error: no alternatives for python. Run:



                        ls /usr/bin/python*


                        Example output:



                        /usr/bin/python /usr/bin/python2 /usr/bin/python2.7 /usr/bin/python3 /usr/bin/python3.5


                        Next, update the Python alternatives list for each version you whish to use with priority 1 and 2:



                        update-alternatives --install /usr/bin/python python /usr/bin/python3.5 1
                        update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2


                        Then run again update-alternatives --config python and select an appropriate version..






                        share|improve this answer






















                        • Could you please clarify what exactly is last two commands are doing here, One more question is i changed in my script from #!/usr/bin/python to #!/usr/bin/python2.7. Is it possible to change the env path for python2.7 to /usr/bin/python
                          – Rahul
                          Dec 25 '18 at 8:52










                        • @Rahul When you use python as a command on terminal the alternatives/aliases are considered. But in scripts as you are the absolute path of python so you need to use the path of python version you want to use.
                          – Kulfy
                          Dec 25 '18 at 8:56










                        • @Rahul, sorry fixed. In this commands you set priority in last numeric params (2 and 1).
                          – mature
                          Dec 25 '18 at 9:16













                        2












                        2








                        2






                        1) To install Python 2 version on Ubuntu 18.04 open up terminal and enter:



                        sudo apt install python-minimal


                        or



                        sudo apt install python2.7


                        Check version:



                        python --version




                        2) If still python 3+ updated list of Python alternatives to perform a switch between any python version is to run:



                        update-alternatives --config python


                        Example:



                        There are 2 choices for the alternative python (providing /usr/bin/python).

                        Selection Path Priority Status
                        ------------------------------------------------------------
                        * 0 /usr/bin/python3.5 2 auto mode
                        1 /usr/bin/python2.7 1 manual mode
                        2 /usr/bin/python3.5 2 manual mode

                        Press <enter> to keep the current choice[*], or type selection number: 1
                        update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in manual mode


                        and select an appropriate version using selction integer as shown above.





                        3) If you see: update-alternatives: error: no alternatives for python. Run:



                        ls /usr/bin/python*


                        Example output:



                        /usr/bin/python /usr/bin/python2 /usr/bin/python2.7 /usr/bin/python3 /usr/bin/python3.5


                        Next, update the Python alternatives list for each version you whish to use with priority 1 and 2:



                        update-alternatives --install /usr/bin/python python /usr/bin/python3.5 1
                        update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2


                        Then run again update-alternatives --config python and select an appropriate version..






                        share|improve this answer














                        1) To install Python 2 version on Ubuntu 18.04 open up terminal and enter:



                        sudo apt install python-minimal


                        or



                        sudo apt install python2.7


                        Check version:



                        python --version




                        2) If still python 3+ updated list of Python alternatives to perform a switch between any python version is to run:



                        update-alternatives --config python


                        Example:



                        There are 2 choices for the alternative python (providing /usr/bin/python).

                        Selection Path Priority Status
                        ------------------------------------------------------------
                        * 0 /usr/bin/python3.5 2 auto mode
                        1 /usr/bin/python2.7 1 manual mode
                        2 /usr/bin/python3.5 2 manual mode

                        Press <enter> to keep the current choice[*], or type selection number: 1
                        update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in manual mode


                        and select an appropriate version using selction integer as shown above.





                        3) If you see: update-alternatives: error: no alternatives for python. Run:



                        ls /usr/bin/python*


                        Example output:



                        /usr/bin/python /usr/bin/python2 /usr/bin/python2.7 /usr/bin/python3 /usr/bin/python3.5


                        Next, update the Python alternatives list for each version you whish to use with priority 1 and 2:



                        update-alternatives --install /usr/bin/python python /usr/bin/python3.5 1
                        update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2


                        Then run again update-alternatives --config python and select an appropriate version..







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Dec 25 '18 at 9:13

























                        answered Dec 25 '18 at 8:28









                        mature

                        1,675523




                        1,675523











                        • Could you please clarify what exactly is last two commands are doing here, One more question is i changed in my script from #!/usr/bin/python to #!/usr/bin/python2.7. Is it possible to change the env path for python2.7 to /usr/bin/python
                          – Rahul
                          Dec 25 '18 at 8:52










                        • @Rahul When you use python as a command on terminal the alternatives/aliases are considered. But in scripts as you are the absolute path of python so you need to use the path of python version you want to use.
                          – Kulfy
                          Dec 25 '18 at 8:56










                        • @Rahul, sorry fixed. In this commands you set priority in last numeric params (2 and 1).
                          – mature
                          Dec 25 '18 at 9:16
















                        • Could you please clarify what exactly is last two commands are doing here, One more question is i changed in my script from #!/usr/bin/python to #!/usr/bin/python2.7. Is it possible to change the env path for python2.7 to /usr/bin/python
                          – Rahul
                          Dec 25 '18 at 8:52










                        • @Rahul When you use python as a command on terminal the alternatives/aliases are considered. But in scripts as you are the absolute path of python so you need to use the path of python version you want to use.
                          – Kulfy
                          Dec 25 '18 at 8:56










                        • @Rahul, sorry fixed. In this commands you set priority in last numeric params (2 and 1).
                          – mature
                          Dec 25 '18 at 9:16















                        Could you please clarify what exactly is last two commands are doing here, One more question is i changed in my script from #!/usr/bin/python to #!/usr/bin/python2.7. Is it possible to change the env path for python2.7 to /usr/bin/python
                        – Rahul
                        Dec 25 '18 at 8:52




                        Could you please clarify what exactly is last two commands are doing here, One more question is i changed in my script from #!/usr/bin/python to #!/usr/bin/python2.7. Is it possible to change the env path for python2.7 to /usr/bin/python
                        – Rahul
                        Dec 25 '18 at 8:52












                        @Rahul When you use python as a command on terminal the alternatives/aliases are considered. But in scripts as you are the absolute path of python so you need to use the path of python version you want to use.
                        – Kulfy
                        Dec 25 '18 at 8:56




                        @Rahul When you use python as a command on terminal the alternatives/aliases are considered. But in scripts as you are the absolute path of python so you need to use the path of python version you want to use.
                        – Kulfy
                        Dec 25 '18 at 8:56












                        @Rahul, sorry fixed. In this commands you set priority in last numeric params (2 and 1).
                        – mature
                        Dec 25 '18 at 9:16




                        @Rahul, sorry fixed. In this commands you set priority in last numeric params (2 and 1).
                        – mature
                        Dec 25 '18 at 9:16











                        1














                        You don't need to remove or disable python3 on your Ubuntu.



                        If you just need python to run small scripts, you can simply install Python 2 as @karel's answer.



                        If you start learning Python, I suggest you to use virtual environment or conda






                        share|improve this answer




















                        • yes got it now, installed python2.7 and checked whereis python2.7 and made script using that env.. Thanks
                          – Rahul
                          Dec 25 '18 at 8:39










                        • Usually, I don't install package from conda, I install package by pip. I just use conda to create global access virtual env.
                          – thangdc94
                          Dec 25 '18 at 9:37















                        1














                        You don't need to remove or disable python3 on your Ubuntu.



                        If you just need python to run small scripts, you can simply install Python 2 as @karel's answer.



                        If you start learning Python, I suggest you to use virtual environment or conda






                        share|improve this answer




















                        • yes got it now, installed python2.7 and checked whereis python2.7 and made script using that env.. Thanks
                          – Rahul
                          Dec 25 '18 at 8:39










                        • Usually, I don't install package from conda, I install package by pip. I just use conda to create global access virtual env.
                          – thangdc94
                          Dec 25 '18 at 9:37













                        1












                        1








                        1






                        You don't need to remove or disable python3 on your Ubuntu.



                        If you just need python to run small scripts, you can simply install Python 2 as @karel's answer.



                        If you start learning Python, I suggest you to use virtual environment or conda






                        share|improve this answer












                        You don't need to remove or disable python3 on your Ubuntu.



                        If you just need python to run small scripts, you can simply install Python 2 as @karel's answer.



                        If you start learning Python, I suggest you to use virtual environment or conda







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Dec 25 '18 at 8:31









                        thangdc94

                        655712




                        655712











                        • yes got it now, installed python2.7 and checked whereis python2.7 and made script using that env.. Thanks
                          – Rahul
                          Dec 25 '18 at 8:39










                        • Usually, I don't install package from conda, I install package by pip. I just use conda to create global access virtual env.
                          – thangdc94
                          Dec 25 '18 at 9:37
















                        • yes got it now, installed python2.7 and checked whereis python2.7 and made script using that env.. Thanks
                          – Rahul
                          Dec 25 '18 at 8:39










                        • Usually, I don't install package from conda, I install package by pip. I just use conda to create global access virtual env.
                          – thangdc94
                          Dec 25 '18 at 9:37















                        yes got it now, installed python2.7 and checked whereis python2.7 and made script using that env.. Thanks
                        – Rahul
                        Dec 25 '18 at 8:39




                        yes got it now, installed python2.7 and checked whereis python2.7 and made script using that env.. Thanks
                        – Rahul
                        Dec 25 '18 at 8:39












                        Usually, I don't install package from conda, I install package by pip. I just use conda to create global access virtual env.
                        – thangdc94
                        Dec 25 '18 at 9:37




                        Usually, I don't install package from conda, I install package by pip. I just use conda to create global access virtual env.
                        – thangdc94
                        Dec 25 '18 at 9:37











                        1














                        No need to disable python 3. You can execute python 2.7 using command python2 filename.py.
                        You can check python 2 version by python2 --version






                        share|improve this answer

























                          1














                          No need to disable python 3. You can execute python 2.7 using command python2 filename.py.
                          You can check python 2 version by python2 --version






                          share|improve this answer























                            1












                            1








                            1






                            No need to disable python 3. You can execute python 2.7 using command python2 filename.py.
                            You can check python 2 version by python2 --version






                            share|improve this answer












                            No need to disable python 3. You can execute python 2.7 using command python2 filename.py.
                            You can check python 2 version by python2 --version







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Dec 26 '18 at 5:54









                            Samihan Jawalkar

                            112




                            112



























                                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.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • 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%2f1104397%2fpython2-7-not-working-in-18-04-python3-is-installed%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 check contact read email or not when send email to Individual?

                                Displaying single band from multi-band raster using QGIS

                                How many registers does an x86_64 CPU actually have?