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;








1















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!










share|improve this question





















  • 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


















1















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!










share|improve this question





















  • 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














1












1








1








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!










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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













  • 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













1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer

























  • 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










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%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









0














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.






share|improve this answer

























  • 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















0














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.






share|improve this answer

























  • 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













0












0








0







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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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








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.



















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%2f55368479%2fpython-version-and-anaconda%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

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해