How to replace a Python 3 installation with Python 2.7

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











up vote
3
down vote

favorite












I already have Python 3 installed on the server machine, and I want to replace that with Python 2.7 as the code I have to deploy is complaint with Python 2.7.



What command should I run so Python application.py runs it on Python 2.7?










share|improve this question









New contributor




SID is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 2




    I wouldn't recommend you replace your python version as that might (most probably) break something on the machine. Instead, install something like virtualenv.
    – ÑÒ¯Ï…к
    5 hours ago














up vote
3
down vote

favorite












I already have Python 3 installed on the server machine, and I want to replace that with Python 2.7 as the code I have to deploy is complaint with Python 2.7.



What command should I run so Python application.py runs it on Python 2.7?










share|improve this question









New contributor




SID is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 2




    I wouldn't recommend you replace your python version as that might (most probably) break something on the machine. Instead, install something like virtualenv.
    – ÑÒ¯Ï…к
    5 hours ago












up vote
3
down vote

favorite









up vote
3
down vote

favorite











I already have Python 3 installed on the server machine, and I want to replace that with Python 2.7 as the code I have to deploy is complaint with Python 2.7.



What command should I run so Python application.py runs it on Python 2.7?










share|improve this question









New contributor




SID is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I already have Python 3 installed on the server machine, and I want to replace that with Python 2.7 as the code I have to deploy is complaint with Python 2.7.



What command should I run so Python application.py runs it on Python 2.7?







python python-2.7






share|improve this question









New contributor




SID is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




SID is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 13 mins ago









Peter Mortensen

1,03821016




1,03821016






New contributor




SID is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 7 hours ago









SID

161




161




New contributor




SID is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





SID is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






SID is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 2




    I wouldn't recommend you replace your python version as that might (most probably) break something on the machine. Instead, install something like virtualenv.
    – ÑÒ¯Ï…к
    5 hours ago












  • 2




    I wouldn't recommend you replace your python version as that might (most probably) break something on the machine. Instead, install something like virtualenv.
    – ÑÒ¯Ï…к
    5 hours ago







2




2




I wouldn't recommend you replace your python version as that might (most probably) break something on the machine. Instead, install something like virtualenv.
– ÑÒ¯Ï…к
5 hours ago




I wouldn't recommend you replace your python version as that might (most probably) break something on the machine. Instead, install something like virtualenv.
– ÑÒ¯Ï…к
5 hours ago










1 Answer
1






active

oldest

votes

















up vote
4
down vote













To control which version of Python, add this line to the top of your script:



#!/usr/bin/env python2


Alternatively, execute your Python script using your chosen Python version:



/usr/bin/python2 /full/path/my/script


Similar steps will enable you to use Python 3 instead of Python 2, assuming your script imports are 3.






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',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    SID is a new contributor. Be nice, and check out our Code of Conduct.









     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1079762%2fhow-to-replace-a-python-3-installation-with-python-2-7%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    4
    down vote













    To control which version of Python, add this line to the top of your script:



    #!/usr/bin/env python2


    Alternatively, execute your Python script using your chosen Python version:



    /usr/bin/python2 /full/path/my/script


    Similar steps will enable you to use Python 3 instead of Python 2, assuming your script imports are 3.






    share|improve this answer


























      up vote
      4
      down vote













      To control which version of Python, add this line to the top of your script:



      #!/usr/bin/env python2


      Alternatively, execute your Python script using your chosen Python version:



      /usr/bin/python2 /full/path/my/script


      Similar steps will enable you to use Python 3 instead of Python 2, assuming your script imports are 3.






      share|improve this answer
























        up vote
        4
        down vote










        up vote
        4
        down vote









        To control which version of Python, add this line to the top of your script:



        #!/usr/bin/env python2


        Alternatively, execute your Python script using your chosen Python version:



        /usr/bin/python2 /full/path/my/script


        Similar steps will enable you to use Python 3 instead of Python 2, assuming your script imports are 3.






        share|improve this answer














        To control which version of Python, add this line to the top of your script:



        #!/usr/bin/env python2


        Alternatively, execute your Python script using your chosen Python version:



        /usr/bin/python2 /full/path/my/script


        Similar steps will enable you to use Python 3 instead of Python 2, assuming your script imports are 3.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 1 hour ago









        Peter Mortensen

        1,03821016




        1,03821016










        answered 7 hours ago









        Scott Stensland

        4,20442239




        4,20442239




















            SID is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            SID is a new contributor. Be nice, and check out our Code of Conduct.












            SID is a new contributor. Be nice, and check out our Code of Conduct.











            SID is a new contributor. Be nice, and check out our Code of Conduct.













             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1079762%2fhow-to-replace-a-python-3-installation-with-python-2-7%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            Long meetings (6-7 hours a day): Being “babysat” by supervisor

            Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

            Confectionery