Change Python version a script is referring to
I have downloaded the script "install_esoreflex" (ftp://ftp.eso.org/pub/dfs/reflex/install_esoreflex) and then execute the following commands:
chmod u+x install_esoreflex
./install_esoreflex
I get the following warnings
WARNING: The following Python version is installed in your system Python 3.7.0
WARNING: Some of the available workflows use functionality
WARNING: only available in version Python 2.6.0 or greater
WARNING: and will not work properly with the installed version.
WARNING: Additionally, python 3.x is not yet supported.
Eventhough I have both Python 3.7.0 and 2.7. Python 2 is installed in /usr/bin/python2 and Python 3 is installed in /home/USER/miniconda3/bin/python3.
How can I make the script "know" I have python 2?
bash script python ubuntu-18.04 python3
add a comment |
I have downloaded the script "install_esoreflex" (ftp://ftp.eso.org/pub/dfs/reflex/install_esoreflex) and then execute the following commands:
chmod u+x install_esoreflex
./install_esoreflex
I get the following warnings
WARNING: The following Python version is installed in your system Python 3.7.0
WARNING: Some of the available workflows use functionality
WARNING: only available in version Python 2.6.0 or greater
WARNING: and will not work properly with the installed version.
WARNING: Additionally, python 3.x is not yet supported.
Eventhough I have both Python 3.7.0 and 2.7. Python 2 is installed in /usr/bin/python2 and Python 3 is installed in /home/USER/miniconda3/bin/python3.
How can I make the script "know" I have python 2?
bash script python ubuntu-18.04 python3
Does the commandpython —version
give you Python 2 or 3? If it gives version 3, typealias python=python2
and then run the script. This pointspython
to version 2 instead of 3.
– agtoever
Dec 25 '18 at 20:22
You must havepython3
first in$PATH
. Try:PATH=/usr/bin:$PATH ./install_esoreflex
.
– Arkadiusz Drabczyk
Dec 25 '18 at 20:24
@agtoever it gives Python 3. You mean I have to runalias python=python2
and then./install_esoreflex
in the same terminal?
– bajotupie
Dec 25 '18 at 20:43
@ArkadiuszDrabczyk this worked. Thanks
– bajotupie
Dec 25 '18 at 21:09
Added it as an answer. Please accept it.
– agtoever
Dec 26 '18 at 5:52
add a comment |
I have downloaded the script "install_esoreflex" (ftp://ftp.eso.org/pub/dfs/reflex/install_esoreflex) and then execute the following commands:
chmod u+x install_esoreflex
./install_esoreflex
I get the following warnings
WARNING: The following Python version is installed in your system Python 3.7.0
WARNING: Some of the available workflows use functionality
WARNING: only available in version Python 2.6.0 or greater
WARNING: and will not work properly with the installed version.
WARNING: Additionally, python 3.x is not yet supported.
Eventhough I have both Python 3.7.0 and 2.7. Python 2 is installed in /usr/bin/python2 and Python 3 is installed in /home/USER/miniconda3/bin/python3.
How can I make the script "know" I have python 2?
bash script python ubuntu-18.04 python3
I have downloaded the script "install_esoreflex" (ftp://ftp.eso.org/pub/dfs/reflex/install_esoreflex) and then execute the following commands:
chmod u+x install_esoreflex
./install_esoreflex
I get the following warnings
WARNING: The following Python version is installed in your system Python 3.7.0
WARNING: Some of the available workflows use functionality
WARNING: only available in version Python 2.6.0 or greater
WARNING: and will not work properly with the installed version.
WARNING: Additionally, python 3.x is not yet supported.
Eventhough I have both Python 3.7.0 and 2.7. Python 2 is installed in /usr/bin/python2 and Python 3 is installed in /home/USER/miniconda3/bin/python3.
How can I make the script "know" I have python 2?
bash script python ubuntu-18.04 python3
bash script python ubuntu-18.04 python3
asked Dec 25 '18 at 20:13
bajotupiebajotupie
51
51
Does the commandpython —version
give you Python 2 or 3? If it gives version 3, typealias python=python2
and then run the script. This pointspython
to version 2 instead of 3.
– agtoever
Dec 25 '18 at 20:22
You must havepython3
first in$PATH
. Try:PATH=/usr/bin:$PATH ./install_esoreflex
.
– Arkadiusz Drabczyk
Dec 25 '18 at 20:24
@agtoever it gives Python 3. You mean I have to runalias python=python2
and then./install_esoreflex
in the same terminal?
– bajotupie
Dec 25 '18 at 20:43
@ArkadiuszDrabczyk this worked. Thanks
– bajotupie
Dec 25 '18 at 21:09
Added it as an answer. Please accept it.
– agtoever
Dec 26 '18 at 5:52
add a comment |
Does the commandpython —version
give you Python 2 or 3? If it gives version 3, typealias python=python2
and then run the script. This pointspython
to version 2 instead of 3.
– agtoever
Dec 25 '18 at 20:22
You must havepython3
first in$PATH
. Try:PATH=/usr/bin:$PATH ./install_esoreflex
.
– Arkadiusz Drabczyk
Dec 25 '18 at 20:24
@agtoever it gives Python 3. You mean I have to runalias python=python2
and then./install_esoreflex
in the same terminal?
– bajotupie
Dec 25 '18 at 20:43
@ArkadiuszDrabczyk this worked. Thanks
– bajotupie
Dec 25 '18 at 21:09
Added it as an answer. Please accept it.
– agtoever
Dec 26 '18 at 5:52
Does the command
python —version
give you Python 2 or 3? If it gives version 3, type alias python=python2
and then run the script. This points python
to version 2 instead of 3.– agtoever
Dec 25 '18 at 20:22
Does the command
python —version
give you Python 2 or 3? If it gives version 3, type alias python=python2
and then run the script. This points python
to version 2 instead of 3.– agtoever
Dec 25 '18 at 20:22
You must have
python3
first in $PATH
. Try: PATH=/usr/bin:$PATH ./install_esoreflex
.– Arkadiusz Drabczyk
Dec 25 '18 at 20:24
You must have
python3
first in $PATH
. Try: PATH=/usr/bin:$PATH ./install_esoreflex
.– Arkadiusz Drabczyk
Dec 25 '18 at 20:24
@agtoever it gives Python 3. You mean I have to run
alias python=python2
and then ./install_esoreflex
in the same terminal?– bajotupie
Dec 25 '18 at 20:43
@agtoever it gives Python 3. You mean I have to run
alias python=python2
and then ./install_esoreflex
in the same terminal?– bajotupie
Dec 25 '18 at 20:43
@ArkadiuszDrabczyk this worked. Thanks
– bajotupie
Dec 25 '18 at 21:09
@ArkadiuszDrabczyk this worked. Thanks
– bajotupie
Dec 25 '18 at 21:09
Added it as an answer. Please accept it.
– agtoever
Dec 26 '18 at 5:52
Added it as an answer. Please accept it.
– agtoever
Dec 26 '18 at 5:52
add a comment |
3 Answers
3
active
oldest
votes
From Ubuntu version 18.04, python 3 is the default python version (link). This means that /usr/bin/python
is symlinked to /usr/bin/python3
. You can check this by running python —version
.
To default to python 2 in scripts (as your install script requires), you need to install the python 2 version (apt-get install python2
). And tell Ubuntu to use that python version.
It is not recommended to change the /usr/bin/python
symlink, because it is part of the distribution maintained configuration. Instead you should use the alias
command (link): alias python=python2
. This (locally) points python
to python2
, which is found in /usr/bin
. You could use this command once in the terminal before running your install script. To change it more permanently, add it to your .bash_profile
.
add a comment |
See if the script has a "shebang" (first line with #!...
) and change the python
reference in it to point to python2
instead of just python
Edit:
OK, so the whole script assumes that your default python
is Python v2. You can perhaps get an installation run successfully using an alias (alias python=python2
) as indicated in comments above.
However, it is likely that the whole package expects python
to be python v2, so you will have to do the same each time you run something from the package. But if you set a permanent alias this may conflict with other things in your system that expect python=python3.
So you may have to use facade scripts to launch parts of that package after setting up an alias for python v2.
The first line is#!/bin/sh
. How do I change the python reference?
– bajotupie
Dec 25 '18 at 20:45
Edited the answer...
– xenoid
Dec 25 '18 at 21:04
the script looks the python binary using command-v python, change that line to command -v python2
– user1330614
Dec 26 '18 at 22:50
add a comment |
this solves your problem in one line without changing system's python symlink which can lead to other problems.
wget ftp://ftp.eso.org/pub/dfs/reflex/install_esoreflex -O - | sed 's/command -v python/command -v python2/g' | sh
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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%2fsuperuser.com%2fquestions%2f1387649%2fchange-python-version-a-script-is-referring-to%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
From Ubuntu version 18.04, python 3 is the default python version (link). This means that /usr/bin/python
is symlinked to /usr/bin/python3
. You can check this by running python —version
.
To default to python 2 in scripts (as your install script requires), you need to install the python 2 version (apt-get install python2
). And tell Ubuntu to use that python version.
It is not recommended to change the /usr/bin/python
symlink, because it is part of the distribution maintained configuration. Instead you should use the alias
command (link): alias python=python2
. This (locally) points python
to python2
, which is found in /usr/bin
. You could use this command once in the terminal before running your install script. To change it more permanently, add it to your .bash_profile
.
add a comment |
From Ubuntu version 18.04, python 3 is the default python version (link). This means that /usr/bin/python
is symlinked to /usr/bin/python3
. You can check this by running python —version
.
To default to python 2 in scripts (as your install script requires), you need to install the python 2 version (apt-get install python2
). And tell Ubuntu to use that python version.
It is not recommended to change the /usr/bin/python
symlink, because it is part of the distribution maintained configuration. Instead you should use the alias
command (link): alias python=python2
. This (locally) points python
to python2
, which is found in /usr/bin
. You could use this command once in the terminal before running your install script. To change it more permanently, add it to your .bash_profile
.
add a comment |
From Ubuntu version 18.04, python 3 is the default python version (link). This means that /usr/bin/python
is symlinked to /usr/bin/python3
. You can check this by running python —version
.
To default to python 2 in scripts (as your install script requires), you need to install the python 2 version (apt-get install python2
). And tell Ubuntu to use that python version.
It is not recommended to change the /usr/bin/python
symlink, because it is part of the distribution maintained configuration. Instead you should use the alias
command (link): alias python=python2
. This (locally) points python
to python2
, which is found in /usr/bin
. You could use this command once in the terminal before running your install script. To change it more permanently, add it to your .bash_profile
.
From Ubuntu version 18.04, python 3 is the default python version (link). This means that /usr/bin/python
is symlinked to /usr/bin/python3
. You can check this by running python —version
.
To default to python 2 in scripts (as your install script requires), you need to install the python 2 version (apt-get install python2
). And tell Ubuntu to use that python version.
It is not recommended to change the /usr/bin/python
symlink, because it is part of the distribution maintained configuration. Instead you should use the alias
command (link): alias python=python2
. This (locally) points python
to python2
, which is found in /usr/bin
. You could use this command once in the terminal before running your install script. To change it more permanently, add it to your .bash_profile
.
answered Dec 26 '18 at 5:50
agtoeveragtoever
5,07911330
5,07911330
add a comment |
add a comment |
See if the script has a "shebang" (first line with #!...
) and change the python
reference in it to point to python2
instead of just python
Edit:
OK, so the whole script assumes that your default python
is Python v2. You can perhaps get an installation run successfully using an alias (alias python=python2
) as indicated in comments above.
However, it is likely that the whole package expects python
to be python v2, so you will have to do the same each time you run something from the package. But if you set a permanent alias this may conflict with other things in your system that expect python=python3.
So you may have to use facade scripts to launch parts of that package after setting up an alias for python v2.
The first line is#!/bin/sh
. How do I change the python reference?
– bajotupie
Dec 25 '18 at 20:45
Edited the answer...
– xenoid
Dec 25 '18 at 21:04
the script looks the python binary using command-v python, change that line to command -v python2
– user1330614
Dec 26 '18 at 22:50
add a comment |
See if the script has a "shebang" (first line with #!...
) and change the python
reference in it to point to python2
instead of just python
Edit:
OK, so the whole script assumes that your default python
is Python v2. You can perhaps get an installation run successfully using an alias (alias python=python2
) as indicated in comments above.
However, it is likely that the whole package expects python
to be python v2, so you will have to do the same each time you run something from the package. But if you set a permanent alias this may conflict with other things in your system that expect python=python3.
So you may have to use facade scripts to launch parts of that package after setting up an alias for python v2.
The first line is#!/bin/sh
. How do I change the python reference?
– bajotupie
Dec 25 '18 at 20:45
Edited the answer...
– xenoid
Dec 25 '18 at 21:04
the script looks the python binary using command-v python, change that line to command -v python2
– user1330614
Dec 26 '18 at 22:50
add a comment |
See if the script has a "shebang" (first line with #!...
) and change the python
reference in it to point to python2
instead of just python
Edit:
OK, so the whole script assumes that your default python
is Python v2. You can perhaps get an installation run successfully using an alias (alias python=python2
) as indicated in comments above.
However, it is likely that the whole package expects python
to be python v2, so you will have to do the same each time you run something from the package. But if you set a permanent alias this may conflict with other things in your system that expect python=python3.
So you may have to use facade scripts to launch parts of that package after setting up an alias for python v2.
See if the script has a "shebang" (first line with #!...
) and change the python
reference in it to point to python2
instead of just python
Edit:
OK, so the whole script assumes that your default python
is Python v2. You can perhaps get an installation run successfully using an alias (alias python=python2
) as indicated in comments above.
However, it is likely that the whole package expects python
to be python v2, so you will have to do the same each time you run something from the package. But if you set a permanent alias this may conflict with other things in your system that expect python=python3.
So you may have to use facade scripts to launch parts of that package after setting up an alias for python v2.
edited Dec 25 '18 at 21:04
answered Dec 25 '18 at 20:21
xenoidxenoid
3,6433718
3,6433718
The first line is#!/bin/sh
. How do I change the python reference?
– bajotupie
Dec 25 '18 at 20:45
Edited the answer...
– xenoid
Dec 25 '18 at 21:04
the script looks the python binary using command-v python, change that line to command -v python2
– user1330614
Dec 26 '18 at 22:50
add a comment |
The first line is#!/bin/sh
. How do I change the python reference?
– bajotupie
Dec 25 '18 at 20:45
Edited the answer...
– xenoid
Dec 25 '18 at 21:04
the script looks the python binary using command-v python, change that line to command -v python2
– user1330614
Dec 26 '18 at 22:50
The first line is
#!/bin/sh
. How do I change the python reference?– bajotupie
Dec 25 '18 at 20:45
The first line is
#!/bin/sh
. How do I change the python reference?– bajotupie
Dec 25 '18 at 20:45
Edited the answer...
– xenoid
Dec 25 '18 at 21:04
Edited the answer...
– xenoid
Dec 25 '18 at 21:04
the script looks the python binary using command-v python, change that line to command -v python2
– user1330614
Dec 26 '18 at 22:50
the script looks the python binary using command-v python, change that line to command -v python2
– user1330614
Dec 26 '18 at 22:50
add a comment |
this solves your problem in one line without changing system's python symlink which can lead to other problems.
wget ftp://ftp.eso.org/pub/dfs/reflex/install_esoreflex -O - | sed 's/command -v python/command -v python2/g' | sh
add a comment |
this solves your problem in one line without changing system's python symlink which can lead to other problems.
wget ftp://ftp.eso.org/pub/dfs/reflex/install_esoreflex -O - | sed 's/command -v python/command -v python2/g' | sh
add a comment |
this solves your problem in one line without changing system's python symlink which can lead to other problems.
wget ftp://ftp.eso.org/pub/dfs/reflex/install_esoreflex -O - | sed 's/command -v python/command -v python2/g' | sh
this solves your problem in one line without changing system's python symlink which can lead to other problems.
wget ftp://ftp.eso.org/pub/dfs/reflex/install_esoreflex -O - | sed 's/command -v python/command -v python2/g' | sh
answered Dec 26 '18 at 22:15
user1330614user1330614
1334
1334
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- 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%2fsuperuser.com%2fquestions%2f1387649%2fchange-python-version-a-script-is-referring-to%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
Does the command
python —version
give you Python 2 or 3? If it gives version 3, typealias python=python2
and then run the script. This pointspython
to version 2 instead of 3.– agtoever
Dec 25 '18 at 20:22
You must have
python3
first in$PATH
. Try:PATH=/usr/bin:$PATH ./install_esoreflex
.– Arkadiusz Drabczyk
Dec 25 '18 at 20:24
@agtoever it gives Python 3. You mean I have to run
alias python=python2
and then./install_esoreflex
in the same terminal?– bajotupie
Dec 25 '18 at 20:43
@ArkadiuszDrabczyk this worked. Thanks
– bajotupie
Dec 25 '18 at 21:09
Added it as an answer. Please accept it.
– agtoever
Dec 26 '18 at 5:52