Python version and AnacondaCalling an external command in PythonWhat are metaclasses in Python?Is there a way to run Python on Android?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?Does Python have a string 'contains' substring method?
Why do my fried eggs start browning very fast?
Different answers of calculations in LuaLaTeX on local computer, lua compiler and on overleaf
Can't understand an ACT practice problem: Triangle appears to be isosceles, why isn't the answer 7.3~ here?
Find the missing country
Meaning of ギャップ in the following sentence
Is the EU really banning "toxic propellants" in 2020? How is that going to work?
Does WSL2 runs Linux in a virtual machine or alongside windows Kernel?
Is an "are" omitted in this sentence
Astable 555 circuit not oscillating
What license to choose for my PhD thesis?
Is there a word that describes people who are extraverted and/or energetic, but uneducated, unintelligent and/or uncreative?
Using Forstner bits instead of hole saws
Deflecting lasers with lightsabers
How can I perform a deterministic physics simulation?
Accurately recalling the key - can everyone do it?
Meaning of "tumbleweed coifs"
Subtle ways to render a planet uninhabitable
Export economy of Mars
Does a bard know when a character uses their Bardic Inspiration?
Is this popular optical illusion made of a grey-scale image with coloured lines?
Where can I see modifications made to the PATH environment variable by the Go installer
Can I say "Gesundheit" if someone is coughing?
How to transform a function from f[#1] to f[x]
What is the reason behind water not falling from a bucket at the top of loop?
Python version and Anaconda
Calling an external command in PythonWhat are metaclasses in Python?Is there a way to run Python on Android?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?Does Python have a string 'contains' substring method?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Recently, I've installed Anaconda3 in a MacOS laptop, but I need to set back the default python version to 2.7 because of some old codes involving the following syntax:
#! /usr/bin/env python
I read some comments and it seems like the easiest way to do it is by using an alias,
alias python="python2"
but even after setting this on my bash_profile, I'm still getting this:
$ which python
/anaconda3/bin/python
What am I doing wrong? Any suggestion is welcome. Thank you in advance!
python macos
add a comment |
Recently, I've installed Anaconda3 in a MacOS laptop, but I need to set back the default python version to 2.7 because of some old codes involving the following syntax:
#! /usr/bin/env python
I read some comments and it seems like the easiest way to do it is by using an alias,
alias python="python2"
but even after setting this on my bash_profile, I'm still getting this:
$ which python
/anaconda3/bin/python
What am I doing wrong? Any suggestion is welcome. Thank you in advance!
python macos
3
Why not create an Anaconda environment instead?
– gmds
Mar 27 at 1:30
@gmds sorry for my ignorance, but I'm running the codes in the terminal, without the direct intervention of Anaconda. Is that relevant for your suggestion?
– surrutiaquir
Mar 27 at 1:37
1
As @gmds pointed out, creating a new environment is probably the easier solution since you have already installed Anaconda. It's really simple to create one and use it link
– kerwei
Mar 27 at 1:58
What I read from his question is that he needs to restore the default behavior because switching to Anaconda has broken things. A virtual env isn't going to help with that, or is at least not IMO the way to go about it.
– Steve
Mar 27 at 2:05
add a comment |
Recently, I've installed Anaconda3 in a MacOS laptop, but I need to set back the default python version to 2.7 because of some old codes involving the following syntax:
#! /usr/bin/env python
I read some comments and it seems like the easiest way to do it is by using an alias,
alias python="python2"
but even after setting this on my bash_profile, I'm still getting this:
$ which python
/anaconda3/bin/python
What am I doing wrong? Any suggestion is welcome. Thank you in advance!
python macos
Recently, I've installed Anaconda3 in a MacOS laptop, but I need to set back the default python version to 2.7 because of some old codes involving the following syntax:
#! /usr/bin/env python
I read some comments and it seems like the easiest way to do it is by using an alias,
alias python="python2"
but even after setting this on my bash_profile, I'm still getting this:
$ which python
/anaconda3/bin/python
What am I doing wrong? Any suggestion is welcome. Thank you in advance!
python macos
python macos
edited Mar 27 at 1:32
surrutiaquir
asked Mar 27 at 1:28
surrutiaquirsurrutiaquir
84 bronze badges
84 bronze badges
3
Why not create an Anaconda environment instead?
– gmds
Mar 27 at 1:30
@gmds sorry for my ignorance, but I'm running the codes in the terminal, without the direct intervention of Anaconda. Is that relevant for your suggestion?
– surrutiaquir
Mar 27 at 1:37
1
As @gmds pointed out, creating a new environment is probably the easier solution since you have already installed Anaconda. It's really simple to create one and use it link
– kerwei
Mar 27 at 1:58
What I read from his question is that he needs to restore the default behavior because switching to Anaconda has broken things. A virtual env isn't going to help with that, or is at least not IMO the way to go about it.
– Steve
Mar 27 at 2:05
add a comment |
3
Why not create an Anaconda environment instead?
– gmds
Mar 27 at 1:30
@gmds sorry for my ignorance, but I'm running the codes in the terminal, without the direct intervention of Anaconda. Is that relevant for your suggestion?
– surrutiaquir
Mar 27 at 1:37
1
As @gmds pointed out, creating a new environment is probably the easier solution since you have already installed Anaconda. It's really simple to create one and use it link
– kerwei
Mar 27 at 1:58
What I read from his question is that he needs to restore the default behavior because switching to Anaconda has broken things. A virtual env isn't going to help with that, or is at least not IMO the way to go about it.
– Steve
Mar 27 at 2:05
3
3
Why not create an Anaconda environment instead?
– gmds
Mar 27 at 1:30
Why not create an Anaconda environment instead?
– gmds
Mar 27 at 1:30
@gmds sorry for my ignorance, but I'm running the codes in the terminal, without the direct intervention of Anaconda. Is that relevant for your suggestion?
– surrutiaquir
Mar 27 at 1:37
@gmds sorry for my ignorance, but I'm running the codes in the terminal, without the direct intervention of Anaconda. Is that relevant for your suggestion?
– surrutiaquir
Mar 27 at 1:37
1
1
As @gmds pointed out, creating a new environment is probably the easier solution since you have already installed Anaconda. It's really simple to create one and use it link
– kerwei
Mar 27 at 1:58
As @gmds pointed out, creating a new environment is probably the easier solution since you have already installed Anaconda. It's really simple to create one and use it link
– kerwei
Mar 27 at 1:58
What I read from his question is that he needs to restore the default behavior because switching to Anaconda has broken things. A virtual env isn't going to help with that, or is at least not IMO the way to go about it.
– Steve
Mar 27 at 2:05
What I read from his question is that he needs to restore the default behavior because switching to Anaconda has broken things. A virtual env isn't going to help with that, or is at least not IMO the way to go about it.
– Steve
Mar 27 at 2:05
add a comment |
1 Answer
1
active
oldest
votes
IMO, you don't want to use an alias to do this. Rather, you want to manipulate your filesystem and/or PATH variable so that the first instance of a binary named 'python' found by the system on your PATH is the one you want to have running by default.
If it made sense to do so, and it was easy to do, an obvious fix would be to uninstall Anaconda. But I assume you still need it.
You could also dig into what the Mac might be doing in your case to manage multiple Python versions in some formal way. This might be the best solution, but I can't tell you how that works. You could Google for that information probably. If you want to take a more basic approach, read on.
What I'd suggest you do first is run the command ls -l `which python`. This will tell you which Python binary is currently the default one, and show you details about that binary. I'm guessing that that "binary" is actually a symbolic link, pointing to some other file. If so, you can just delete that link, or rename it to something else. The same thing will work if what you see is not a symbolic link, but rather a real executable, but it's a bigger deal to decide to delete or rename a real executable. If you just rename this file, you can obviously reverse what you've done any time you want.
Once you do this, do ls -l `which python` again. This should give you a new answer and be pointing at the original python installation. You can confirm which version of python is now the default by running python.
That is working, thank you so much
– surrutiaquir
Mar 27 at 14:45
Can you please click the "Check Mark" to say that this answer answered your question? Thanks
– Steve
Mar 27 at 15:22
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%2f55368479%2fpython-version-and-anaconda%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
IMO, you don't want to use an alias to do this. Rather, you want to manipulate your filesystem and/or PATH variable so that the first instance of a binary named 'python' found by the system on your PATH is the one you want to have running by default.
If it made sense to do so, and it was easy to do, an obvious fix would be to uninstall Anaconda. But I assume you still need it.
You could also dig into what the Mac might be doing in your case to manage multiple Python versions in some formal way. This might be the best solution, but I can't tell you how that works. You could Google for that information probably. If you want to take a more basic approach, read on.
What I'd suggest you do first is run the command ls -l `which python`. This will tell you which Python binary is currently the default one, and show you details about that binary. I'm guessing that that "binary" is actually a symbolic link, pointing to some other file. If so, you can just delete that link, or rename it to something else. The same thing will work if what you see is not a symbolic link, but rather a real executable, but it's a bigger deal to decide to delete or rename a real executable. If you just rename this file, you can obviously reverse what you've done any time you want.
Once you do this, do ls -l `which python` again. This should give you a new answer and be pointing at the original python installation. You can confirm which version of python is now the default by running python.
That is working, thank you so much
– surrutiaquir
Mar 27 at 14:45
Can you please click the "Check Mark" to say that this answer answered your question? Thanks
– Steve
Mar 27 at 15:22
add a comment |
IMO, you don't want to use an alias to do this. Rather, you want to manipulate your filesystem and/or PATH variable so that the first instance of a binary named 'python' found by the system on your PATH is the one you want to have running by default.
If it made sense to do so, and it was easy to do, an obvious fix would be to uninstall Anaconda. But I assume you still need it.
You could also dig into what the Mac might be doing in your case to manage multiple Python versions in some formal way. This might be the best solution, but I can't tell you how that works. You could Google for that information probably. If you want to take a more basic approach, read on.
What I'd suggest you do first is run the command ls -l `which python`. This will tell you which Python binary is currently the default one, and show you details about that binary. I'm guessing that that "binary" is actually a symbolic link, pointing to some other file. If so, you can just delete that link, or rename it to something else. The same thing will work if what you see is not a symbolic link, but rather a real executable, but it's a bigger deal to decide to delete or rename a real executable. If you just rename this file, you can obviously reverse what you've done any time you want.
Once you do this, do ls -l `which python` again. This should give you a new answer and be pointing at the original python installation. You can confirm which version of python is now the default by running python.
That is working, thank you so much
– surrutiaquir
Mar 27 at 14:45
Can you please click the "Check Mark" to say that this answer answered your question? Thanks
– Steve
Mar 27 at 15:22
add a comment |
IMO, you don't want to use an alias to do this. Rather, you want to manipulate your filesystem and/or PATH variable so that the first instance of a binary named 'python' found by the system on your PATH is the one you want to have running by default.
If it made sense to do so, and it was easy to do, an obvious fix would be to uninstall Anaconda. But I assume you still need it.
You could also dig into what the Mac might be doing in your case to manage multiple Python versions in some formal way. This might be the best solution, but I can't tell you how that works. You could Google for that information probably. If you want to take a more basic approach, read on.
What I'd suggest you do first is run the command ls -l `which python`. This will tell you which Python binary is currently the default one, and show you details about that binary. I'm guessing that that "binary" is actually a symbolic link, pointing to some other file. If so, you can just delete that link, or rename it to something else. The same thing will work if what you see is not a symbolic link, but rather a real executable, but it's a bigger deal to decide to delete or rename a real executable. If you just rename this file, you can obviously reverse what you've done any time you want.
Once you do this, do ls -l `which python` again. This should give you a new answer and be pointing at the original python installation. You can confirm which version of python is now the default by running python.
IMO, you don't want to use an alias to do this. Rather, you want to manipulate your filesystem and/or PATH variable so that the first instance of a binary named 'python' found by the system on your PATH is the one you want to have running by default.
If it made sense to do so, and it was easy to do, an obvious fix would be to uninstall Anaconda. But I assume you still need it.
You could also dig into what the Mac might be doing in your case to manage multiple Python versions in some formal way. This might be the best solution, but I can't tell you how that works. You could Google for that information probably. If you want to take a more basic approach, read on.
What I'd suggest you do first is run the command ls -l `which python`. This will tell you which Python binary is currently the default one, and show you details about that binary. I'm guessing that that "binary" is actually a symbolic link, pointing to some other file. If so, you can just delete that link, or rename it to something else. The same thing will work if what you see is not a symbolic link, but rather a real executable, but it's a bigger deal to decide to delete or rename a real executable. If you just rename this file, you can obviously reverse what you've done any time you want.
Once you do this, do ls -l `which python` again. This should give you a new answer and be pointing at the original python installation. You can confirm which version of python is now the default by running python.
answered Mar 27 at 1:52
SteveSteve
4,8051 gold badge8 silver badges31 bronze badges
4,8051 gold badge8 silver badges31 bronze badges
That is working, thank you so much
– surrutiaquir
Mar 27 at 14:45
Can you please click the "Check Mark" to say that this answer answered your question? Thanks
– Steve
Mar 27 at 15:22
add a comment |
That is working, thank you so much
– surrutiaquir
Mar 27 at 14:45
Can you please click the "Check Mark" to say that this answer answered your question? Thanks
– Steve
Mar 27 at 15:22
That is working, thank you so much
– surrutiaquir
Mar 27 at 14:45
That is working, thank you so much
– surrutiaquir
Mar 27 at 14:45
Can you please click the "Check Mark" to say that this answer answered your question? Thanks
– Steve
Mar 27 at 15:22
Can you please click the "Check Mark" to say that this answer answered your question? Thanks
– Steve
Mar 27 at 15:22
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
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%2f55368479%2fpython-version-and-anaconda%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
3
Why not create an Anaconda environment instead?
– gmds
Mar 27 at 1:30
@gmds sorry for my ignorance, but I'm running the codes in the terminal, without the direct intervention of Anaconda. Is that relevant for your suggestion?
– surrutiaquir
Mar 27 at 1:37
1
As @gmds pointed out, creating a new environment is probably the easier solution since you have already installed Anaconda. It's really simple to create one and use it link
– kerwei
Mar 27 at 1:58
What I read from his question is that he needs to restore the default behavior because switching to Anaconda has broken things. A virtual env isn't going to help with that, or is at least not IMO the way to go about it.
– Steve
Mar 27 at 2:05