How to install python launcher
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
add a comment |
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
add a comment |
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
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
python launcher shebang
asked Aug 15 '18 at 15:39
Sean ZhangSean Zhang
1
1
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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
.
Thank you. I want to know how to install/use Python launcher (i.e. command "py").
– Sean Zhang
Aug 15 '18 at 15:54
add a comment |
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:
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
.
Thank you. I want to know how to install/use Python launcher (i.e. command "py").
– Sean Zhang
Aug 15 '18 at 15:54
add a comment |
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
.
Thank you. I want to know how to install/use Python launcher (i.e. command "py").
– Sean Zhang
Aug 15 '18 at 15:54
add a comment |
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
.
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
.
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
add a comment |
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
add a comment |
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:
add a comment |
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:
add a comment |
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:
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:
edited Nov 13 '18 at 15:58
answered Nov 13 '18 at 15:43
RabarberskiRabarberski
10k176182
10k176182
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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