How to install python launcher












0















I want to run Python script using "Python launcher" so that I can use shebang line to specify the Python environment for each individual script.



I installed Python 3.6 from Anaconda.



However, when I type "py" in conda prompt or windows CMD, it says 'py' is not recognized as an internal or external command.



What should I do in order to use "py" command to launch Python script?










share|improve this question



























    0















    I want to run Python script using "Python launcher" so that I can use shebang line to specify the Python environment for each individual script.



    I installed Python 3.6 from Anaconda.



    However, when I type "py" in conda prompt or windows CMD, it says 'py' is not recognized as an internal or external command.



    What should I do in order to use "py" command to launch Python script?










    share|improve this question

























      0












      0








      0


      0






      I want to run Python script using "Python launcher" so that I can use shebang line to specify the Python environment for each individual script.



      I installed Python 3.6 from Anaconda.



      However, when I type "py" in conda prompt or windows CMD, it says 'py' is not recognized as an internal or external command.



      What should I do in order to use "py" command to launch Python script?










      share|improve this question














      I want to run Python script using "Python launcher" so that I can use shebang line to specify the Python environment for each individual script.



      I installed Python 3.6 from Anaconda.



      However, when I type "py" in conda prompt or windows CMD, it says 'py' is not recognized as an internal or external command.



      What should I do in order to use "py" command to launch Python script?







      python launcher shebang






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 15 '18 at 15:39









      Sean ZhangSean Zhang

      1




      1
























          2 Answers
          2






          active

          oldest

          votes


















          0














          Unless you are using cygwin, windows has no shebang support. However, when you install Python, it should associate .py files with Python on the command line. Try running the script by just using the script name from your command line, or double-clicking the script in explorer. If this file-type association does not exist, you should also be able to run your script using conda script.py.






          share|improve this answer
























          • Thank you. I want to know how to install/use Python launcher (i.e. command "py").

            – Sean Zhang
            Aug 15 '18 at 15:54



















          0














          It looks like Anaconda does not come with the py launcher. Some workarounds here https://stackoverflow.com/a/30794388/50899.



          The standard 3.x Python installers for Windows (I think from Python 3.3 and onward) have an option to also install the py launcher. See the screenshots below.
          As far as I know, it is even selected by default.



          After that, you can include python shebang lines as documented e.g.,




          • here: https://docs.python.org/3/using/windows.html#launcher, or

          • if you want to have a shorter version: http://testerstories.com/2014/06/multiple-versions-of-python-on-windows/


          Note that (as explained here):




          The launcher is restricted to launching Python scripts. It is not
          intended as a general-purpose script launcher or shebang processor.




          Screenshots:



          first installer screensecond installer screen






          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            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%2fstackoverflow.com%2fquestions%2f51861943%2fhow-to-install-python-launcher%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Unless you are using cygwin, windows has no shebang support. However, when you install Python, it should associate .py files with Python on the command line. Try running the script by just using the script name from your command line, or double-clicking the script in explorer. If this file-type association does not exist, you should also be able to run your script using conda script.py.






            share|improve this answer
























            • Thank you. I want to know how to install/use Python launcher (i.e. command "py").

              – Sean Zhang
              Aug 15 '18 at 15:54
















            0














            Unless you are using cygwin, windows has no shebang support. However, when you install Python, it should associate .py files with Python on the command line. Try running the script by just using the script name from your command line, or double-clicking the script in explorer. If this file-type association does not exist, you should also be able to run your script using conda script.py.






            share|improve this answer
























            • Thank you. I want to know how to install/use Python launcher (i.e. command "py").

              – Sean Zhang
              Aug 15 '18 at 15:54














            0












            0








            0







            Unless you are using cygwin, windows has no shebang support. However, when you install Python, it should associate .py files with Python on the command line. Try running the script by just using the script name from your command line, or double-clicking the script in explorer. If this file-type association does not exist, you should also be able to run your script using conda script.py.






            share|improve this answer













            Unless you are using cygwin, windows has no shebang support. However, when you install Python, it should associate .py files with Python on the command line. Try running the script by just using the script name from your command line, or double-clicking the script in explorer. If this file-type association does not exist, you should also be able to run your script using conda script.py.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 15 '18 at 15:45









            J. BlackadarJ. Blackadar

            854214




            854214













            • Thank you. I want to know how to install/use Python launcher (i.e. command "py").

              – Sean Zhang
              Aug 15 '18 at 15:54



















            • Thank you. I want to know how to install/use Python launcher (i.e. command "py").

              – Sean Zhang
              Aug 15 '18 at 15:54

















            Thank you. I want to know how to install/use Python launcher (i.e. command "py").

            – Sean Zhang
            Aug 15 '18 at 15:54





            Thank you. I want to know how to install/use Python launcher (i.e. command "py").

            – Sean Zhang
            Aug 15 '18 at 15:54













            0














            It looks like Anaconda does not come with the py launcher. Some workarounds here https://stackoverflow.com/a/30794388/50899.



            The standard 3.x Python installers for Windows (I think from Python 3.3 and onward) have an option to also install the py launcher. See the screenshots below.
            As far as I know, it is even selected by default.



            After that, you can include python shebang lines as documented e.g.,




            • here: https://docs.python.org/3/using/windows.html#launcher, or

            • if you want to have a shorter version: http://testerstories.com/2014/06/multiple-versions-of-python-on-windows/


            Note that (as explained here):




            The launcher is restricted to launching Python scripts. It is not
            intended as a general-purpose script launcher or shebang processor.




            Screenshots:



            first installer screensecond installer screen






            share|improve this answer






























              0














              It looks like Anaconda does not come with the py launcher. Some workarounds here https://stackoverflow.com/a/30794388/50899.



              The standard 3.x Python installers for Windows (I think from Python 3.3 and onward) have an option to also install the py launcher. See the screenshots below.
              As far as I know, it is even selected by default.



              After that, you can include python shebang lines as documented e.g.,




              • here: https://docs.python.org/3/using/windows.html#launcher, or

              • if you want to have a shorter version: http://testerstories.com/2014/06/multiple-versions-of-python-on-windows/


              Note that (as explained here):




              The launcher is restricted to launching Python scripts. It is not
              intended as a general-purpose script launcher or shebang processor.




              Screenshots:



              first installer screensecond installer screen






              share|improve this answer




























                0












                0








                0







                It looks like Anaconda does not come with the py launcher. Some workarounds here https://stackoverflow.com/a/30794388/50899.



                The standard 3.x Python installers for Windows (I think from Python 3.3 and onward) have an option to also install the py launcher. See the screenshots below.
                As far as I know, it is even selected by default.



                After that, you can include python shebang lines as documented e.g.,




                • here: https://docs.python.org/3/using/windows.html#launcher, or

                • if you want to have a shorter version: http://testerstories.com/2014/06/multiple-versions-of-python-on-windows/


                Note that (as explained here):




                The launcher is restricted to launching Python scripts. It is not
                intended as a general-purpose script launcher or shebang processor.




                Screenshots:



                first installer screensecond installer screen






                share|improve this answer















                It looks like Anaconda does not come with the py launcher. Some workarounds here https://stackoverflow.com/a/30794388/50899.



                The standard 3.x Python installers for Windows (I think from Python 3.3 and onward) have an option to also install the py launcher. See the screenshots below.
                As far as I know, it is even selected by default.



                After that, you can include python shebang lines as documented e.g.,




                • here: https://docs.python.org/3/using/windows.html#launcher, or

                • if you want to have a shorter version: http://testerstories.com/2014/06/multiple-versions-of-python-on-windows/


                Note that (as explained here):




                The launcher is restricted to launching Python scripts. It is not
                intended as a general-purpose script launcher or shebang processor.




                Screenshots:



                first installer screensecond installer screen







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 13 '18 at 15:58

























                answered Nov 13 '18 at 15:43









                RabarberskiRabarberski

                10k176182




                10k176182






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • 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%2fstackoverflow.com%2fquestions%2f51861943%2fhow-to-install-python-launcher%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

                    Full-time equivalent

                    さくらももこ

                    13 indicted, 8 arrested in Calif. drug cartel investigation