How do I switch back to python2 after Anaconda set python3 as the default?











up vote
14
down vote

favorite
9












Recently, I installed Anaconda3-2.5.0-Linux-x86_64.sh on my 15.04 and ended up with this!



:~$ python --version
Python 3.5.1 :: Anaconda 2.5.0 (64-bit)

:~$ python2 --version
Python 2.7.9

:~$ python3 --version
Python 3.5.1 :: Anaconda 2.5.0 (64-bit)


During the last moments of installation, I did enter something as yes in hurry, and I suppose it had to do something with this. (Ok, my fault, I should have handled that carefully, but I need help now, not criticism).



Screenshot



AFAIK this is definitely going to break other programs. What do I do now?





What I think could work.



Can this be done using aliases?



alias python=python2


But I ain't sure.










share|improve this question
























  • Yes. use alias python=python2
    – Mostafa Ahangarha
    Mar 20 '16 at 9:41










  • AFAIK this is definitely going to break other programs. What makes you think so? If Anaconda sets Python 3 as the default, it's probably for a reason.
    – fkraiem
    Mar 20 '16 at 10:02










  • I already have ruined one of my projects that was written for 2.x, and converting default to 3.x is not encouraged especially since many packages work on 2.x!
    – sinister
    Mar 20 '16 at 10:10










  • This is when you are very glad that you took the professional approach and had a clone of your pre-install boot drive to prevent this from becoming a big time-waster. Please see my answer below. I think your install method caused the glitch. So if this happened to me I would revert and retry. Total time would be less than a day to figure out whether it is viable. In my case, as you can see, I am at the end of verifications so can now progress to see if this is worth the effort in the first place. Took a couple days to make sure it hadn't caused a problem, and research work is on track.
    – SDsolar
    Dec 19 '17 at 9:44












  • as for specifying the version of Python, be sure you know exactly the ripple effect this can have throughout your whole system. Unless you are just playing, it will really require a full verification process if you change the targets of the default which python shebang results. It takes just a bit of time up front to prevent later discovering that you have painted yourself into the corner of needing to rewrite some of your utilities. Best is to leave things working with the defaults unless you have a lot of time on your hands.
    – SDsolar
    Dec 19 '17 at 9:47















up vote
14
down vote

favorite
9












Recently, I installed Anaconda3-2.5.0-Linux-x86_64.sh on my 15.04 and ended up with this!



:~$ python --version
Python 3.5.1 :: Anaconda 2.5.0 (64-bit)

:~$ python2 --version
Python 2.7.9

:~$ python3 --version
Python 3.5.1 :: Anaconda 2.5.0 (64-bit)


During the last moments of installation, I did enter something as yes in hurry, and I suppose it had to do something with this. (Ok, my fault, I should have handled that carefully, but I need help now, not criticism).



Screenshot



AFAIK this is definitely going to break other programs. What do I do now?





What I think could work.



Can this be done using aliases?



alias python=python2


But I ain't sure.










share|improve this question
























  • Yes. use alias python=python2
    – Mostafa Ahangarha
    Mar 20 '16 at 9:41










  • AFAIK this is definitely going to break other programs. What makes you think so? If Anaconda sets Python 3 as the default, it's probably for a reason.
    – fkraiem
    Mar 20 '16 at 10:02










  • I already have ruined one of my projects that was written for 2.x, and converting default to 3.x is not encouraged especially since many packages work on 2.x!
    – sinister
    Mar 20 '16 at 10:10










  • This is when you are very glad that you took the professional approach and had a clone of your pre-install boot drive to prevent this from becoming a big time-waster. Please see my answer below. I think your install method caused the glitch. So if this happened to me I would revert and retry. Total time would be less than a day to figure out whether it is viable. In my case, as you can see, I am at the end of verifications so can now progress to see if this is worth the effort in the first place. Took a couple days to make sure it hadn't caused a problem, and research work is on track.
    – SDsolar
    Dec 19 '17 at 9:44












  • as for specifying the version of Python, be sure you know exactly the ripple effect this can have throughout your whole system. Unless you are just playing, it will really require a full verification process if you change the targets of the default which python shebang results. It takes just a bit of time up front to prevent later discovering that you have painted yourself into the corner of needing to rewrite some of your utilities. Best is to leave things working with the defaults unless you have a lot of time on your hands.
    – SDsolar
    Dec 19 '17 at 9:47













up vote
14
down vote

favorite
9









up vote
14
down vote

favorite
9






9





Recently, I installed Anaconda3-2.5.0-Linux-x86_64.sh on my 15.04 and ended up with this!



:~$ python --version
Python 3.5.1 :: Anaconda 2.5.0 (64-bit)

:~$ python2 --version
Python 2.7.9

:~$ python3 --version
Python 3.5.1 :: Anaconda 2.5.0 (64-bit)


During the last moments of installation, I did enter something as yes in hurry, and I suppose it had to do something with this. (Ok, my fault, I should have handled that carefully, but I need help now, not criticism).



Screenshot



AFAIK this is definitely going to break other programs. What do I do now?





What I think could work.



Can this be done using aliases?



alias python=python2


But I ain't sure.










share|improve this question















Recently, I installed Anaconda3-2.5.0-Linux-x86_64.sh on my 15.04 and ended up with this!



:~$ python --version
Python 3.5.1 :: Anaconda 2.5.0 (64-bit)

:~$ python2 --version
Python 2.7.9

:~$ python3 --version
Python 3.5.1 :: Anaconda 2.5.0 (64-bit)


During the last moments of installation, I did enter something as yes in hurry, and I suppose it had to do something with this. (Ok, my fault, I should have handled that carefully, but I need help now, not criticism).



Screenshot



AFAIK this is definitely going to break other programs. What do I do now?





What I think could work.



Can this be done using aliases?



alias python=python2


But I ain't sure.







python3 python-2.7 anaconda






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 20 '16 at 12:09









muru

135k19289490




135k19289490










asked Mar 20 '16 at 9:05









sinister

75117




75117












  • Yes. use alias python=python2
    – Mostafa Ahangarha
    Mar 20 '16 at 9:41










  • AFAIK this is definitely going to break other programs. What makes you think so? If Anaconda sets Python 3 as the default, it's probably for a reason.
    – fkraiem
    Mar 20 '16 at 10:02










  • I already have ruined one of my projects that was written for 2.x, and converting default to 3.x is not encouraged especially since many packages work on 2.x!
    – sinister
    Mar 20 '16 at 10:10










  • This is when you are very glad that you took the professional approach and had a clone of your pre-install boot drive to prevent this from becoming a big time-waster. Please see my answer below. I think your install method caused the glitch. So if this happened to me I would revert and retry. Total time would be less than a day to figure out whether it is viable. In my case, as you can see, I am at the end of verifications so can now progress to see if this is worth the effort in the first place. Took a couple days to make sure it hadn't caused a problem, and research work is on track.
    – SDsolar
    Dec 19 '17 at 9:44












  • as for specifying the version of Python, be sure you know exactly the ripple effect this can have throughout your whole system. Unless you are just playing, it will really require a full verification process if you change the targets of the default which python shebang results. It takes just a bit of time up front to prevent later discovering that you have painted yourself into the corner of needing to rewrite some of your utilities. Best is to leave things working with the defaults unless you have a lot of time on your hands.
    – SDsolar
    Dec 19 '17 at 9:47


















  • Yes. use alias python=python2
    – Mostafa Ahangarha
    Mar 20 '16 at 9:41










  • AFAIK this is definitely going to break other programs. What makes you think so? If Anaconda sets Python 3 as the default, it's probably for a reason.
    – fkraiem
    Mar 20 '16 at 10:02










  • I already have ruined one of my projects that was written for 2.x, and converting default to 3.x is not encouraged especially since many packages work on 2.x!
    – sinister
    Mar 20 '16 at 10:10










  • This is when you are very glad that you took the professional approach and had a clone of your pre-install boot drive to prevent this from becoming a big time-waster. Please see my answer below. I think your install method caused the glitch. So if this happened to me I would revert and retry. Total time would be less than a day to figure out whether it is viable. In my case, as you can see, I am at the end of verifications so can now progress to see if this is worth the effort in the first place. Took a couple days to make sure it hadn't caused a problem, and research work is on track.
    – SDsolar
    Dec 19 '17 at 9:44












  • as for specifying the version of Python, be sure you know exactly the ripple effect this can have throughout your whole system. Unless you are just playing, it will really require a full verification process if you change the targets of the default which python shebang results. It takes just a bit of time up front to prevent later discovering that you have painted yourself into the corner of needing to rewrite some of your utilities. Best is to leave things working with the defaults unless you have a lot of time on your hands.
    – SDsolar
    Dec 19 '17 at 9:47
















Yes. use alias python=python2
– Mostafa Ahangarha
Mar 20 '16 at 9:41




Yes. use alias python=python2
– Mostafa Ahangarha
Mar 20 '16 at 9:41












AFAIK this is definitely going to break other programs. What makes you think so? If Anaconda sets Python 3 as the default, it's probably for a reason.
– fkraiem
Mar 20 '16 at 10:02




AFAIK this is definitely going to break other programs. What makes you think so? If Anaconda sets Python 3 as the default, it's probably for a reason.
– fkraiem
Mar 20 '16 at 10:02












I already have ruined one of my projects that was written for 2.x, and converting default to 3.x is not encouraged especially since many packages work on 2.x!
– sinister
Mar 20 '16 at 10:10




I already have ruined one of my projects that was written for 2.x, and converting default to 3.x is not encouraged especially since many packages work on 2.x!
– sinister
Mar 20 '16 at 10:10












This is when you are very glad that you took the professional approach and had a clone of your pre-install boot drive to prevent this from becoming a big time-waster. Please see my answer below. I think your install method caused the glitch. So if this happened to me I would revert and retry. Total time would be less than a day to figure out whether it is viable. In my case, as you can see, I am at the end of verifications so can now progress to see if this is worth the effort in the first place. Took a couple days to make sure it hadn't caused a problem, and research work is on track.
– SDsolar
Dec 19 '17 at 9:44






This is when you are very glad that you took the professional approach and had a clone of your pre-install boot drive to prevent this from becoming a big time-waster. Please see my answer below. I think your install method caused the glitch. So if this happened to me I would revert and retry. Total time would be less than a day to figure out whether it is viable. In my case, as you can see, I am at the end of verifications so can now progress to see if this is worth the effort in the first place. Took a couple days to make sure it hadn't caused a problem, and research work is on track.
– SDsolar
Dec 19 '17 at 9:44














as for specifying the version of Python, be sure you know exactly the ripple effect this can have throughout your whole system. Unless you are just playing, it will really require a full verification process if you change the targets of the default which python shebang results. It takes just a bit of time up front to prevent later discovering that you have painted yourself into the corner of needing to rewrite some of your utilities. Best is to leave things working with the defaults unless you have a lot of time on your hands.
– SDsolar
Dec 19 '17 at 9:47




as for specifying the version of Python, be sure you know exactly the ripple effect this can have throughout your whole system. Unless you are just playing, it will really require a full verification process if you change the targets of the default which python shebang results. It takes just a bit of time up front to prevent later discovering that you have painted yourself into the corner of needing to rewrite some of your utilities. Best is to leave things working with the defaults unless you have a lot of time on your hands.
– SDsolar
Dec 19 '17 at 9:47










5 Answers
5






active

oldest

votes

















up vote
13
down vote



accepted










I went through the installation in a VM, and the following happend.




  1. The installer asks for an install location. Default is /home/myuser/anaconda3.


  2. At the end you'll be asked



    Python 3.5.1 :: Continuum Analytics, Inc.
    creating default environment...
    installation finished.
    Do you wish the installer to prepend the Anaconda3 install location
    to PATH in your /home/myuser/.bashrc ? [yes|no]
    [no] >>> yes

    Prepending PATH=/home/myuser/anaconda3/bin to PATH in /home/myuser/.bashrc
    A backup will be made to: /home/myuser/.bashrc-anaconda3.bak



To restore the old behavior, go to your home directory and do



mv .bashrc-anaconda3.bak .bashrc


then start a new shell.



As you suggest, you could alias python=python2, but I find that a bit weird.
I would




  1. Restore the original .bashrc

  2. Create (if it does not exist) ~/bin

  3. Link ln -s ~/anaconda3/bin/python3 ~/bin/python3

  4. [Prepend $HOME/bin to $PATH](Should already be set by default by ~/.profile)

  5. Relogin.


That way, calling python3 will start the one from Anaconda.




An important point is, that the original /usr/bin/python is still there, and still points to python2.7. The ramifications of having python->python3 in your path depend on how a specific script is called.

If the shebang #!/usr/bin/python is used, like it probably is in all executables that ship with Ubuntu, nothing will change.
On the other hand, for better portability #!/usr/bin/env python is sometimes used, which will now cause python3.5 to be called.






share|improve this answer



















  • 3




    "4. Prepend $HOME/bin to $PATH" .. already done by default ~/.profile - just a relogin is needed after creating ~/bin.
    – muru
    Mar 20 '16 at 11:15










  • @muru That's true, thanks. Added to the answer.
    – Nephente
    Mar 20 '16 at 11:28










  • okay, that worked, thanks! Just to put this into notice, that I had python 3.4.3 also installed previously (and pip and pip3 were both associated with it), now I have 2.7, 3.4, 3.5. Now I'm gonna re-install pip to point it to 3.5!
    – sinister
    Mar 20 '16 at 12:17










  • Anaconda comes with its own package manager called conda. It also manages virtual environments. I use that to install packages instead of pip.
    – Nephente
    Mar 20 '16 at 12:36








  • 1




    See stackoverflow.com/questions/20994716/…
    – Nephente
    Mar 20 '16 at 12:38


















up vote
7
down vote













Good answer here:
https://stackoverflow.com/questions/24405561/how-to-install-2-anacondas-python-2-7-and-3-4-on-mac-os-10-9



conda create -n python2 python=2.7 anaconda


then, to switch:



source activate python2





share|improve this answer























  • If you need this you could very well have much deeper problems. If your system is important, do a full verification of any Python-dependent commands and/or utilities. Fair warning.
    – SDsolar
    Dec 19 '17 at 9:55


















up vote
3
down vote













In case anyone is looking to change their python default version back to 2.7 after messing it up(by changing default one to: anaconda or python 3) and ending up with non-functional software, just follow this link: Link with instructions to change default python version.






share|improve this answer





















  • If a system change goes awry, be sure you can roll it back. Make sure you have good system image backups so any major changes can be reversed quickly if they don't go as you plan. Think professional. If you use amateur techniques then you can't expect professional results.
    – SDsolar
    Dec 19 '17 at 9:28












  • best answer! thanks.
    – Hridaynath
    Feb 9 at 11:23


















up vote
1
down vote













This worked for me but for Miniconda, it should also work for Anaconda but please correct me if I'm wrong.



First get your $PATH variable:



echo $PATH


It will probably look like this (miniconda path before everything else):



/home/your_user/miniconda3/bin:$PATH


Copy that path to the bottom of your ~/.bashrc file, but with Miniconda at the end instead of the beginning of the path like so:



export PATH="$PATH:/home/your_user/miniconda3/bin"


The system will look for programs at the start of the $PATH variable before the miniconda3/bin folder.



It should restore the versions for previous programs you had like python.



Starting in Conda 4.4, they changed the code added to ~/.bashrc. Now, to achieve the same thing, edit ~/.bashrc and comment out the line below like so to prevent the base layer (base environment) from activating in every terminal. No need to touch any other part of the new additions. I am uncertain what significance CONDA_CHANGEPS1=false has, but haven't run into any issues so far.



   # CONDA_CHANGEPS1=false conda activate base


And while you won't see the conda folder in the path anymore, the conda command will still run fine, and your original python, python3, and pipenv commands will as well.






share|improve this answer























  • Upvote because I think you are correct. This is good to have in the database. However, can I please ask that you be a tad more specific as to version numbers of the software involved?
    – SDsolar
    Dec 19 '17 at 8:23










  • Thank you, and I don't really think that the program version matters, this should always work. At the time my installer was at the following version however: Miniconda3 4.3.14. Does that help?
    – ronalara
    Jan 12 at 22:03




















up vote
0
down vote













Here is my answer, and it may or may not be the actual specific answer to what you have done to your own system.



However, I am in a similar situation and had the very same concern.



I am using Ubuntu 16.04 LTS and Python 2.7.12, and just recently installed Anaconda.



So now, when I go to the command line and type python it still goes to my Python2 installation.



Confirmed by this sequesnce:



$which python
/usr/bin/python < Catch-all for max compatibility
$python
Python 2.7.12 . . etc


So in my case, anaconda does NOT cause any problem with my default Python2 shebangs.



Ultimately, that is the question.



When you ask the system which python you can trust that to be correct string to use in the first line of your command-line style Python programs.



In my situation, all my same Python command-line script files continue to execute just fine.



I tend to write Python in a 3-compatible mode. Such as using parentheses around my print statements. But I am actively resisting a major change to the system that might cause hard-fought Python 2 programs to encounter glitches. Python 3 sounds great but unnecessary for my needs. Python 2 is an amazing language.



My computing environment does not allow me to go back and re-engineer past processes that have been tuned to work correctly without taking a mjor time hit since I would have to go back and figure out where I used it in the first place.





Bottom line for me: Upon install anaconda for future use, I have not had any speed bumps nor problems.





That is the point where I am in the process... Just finished re-certifying all the past software.





Next step is to actually use some of the cool stuff that is promised in the package.





So, I must suspect that other simply installing anaconda there must be more to your situation.



From my experience it is not a problem at all.






share|improve this answer























  • FYI, I have a complete Scientific workstation, working on solar dynamics. Also about ephemerals and satellite interactions. It MUST work. SO I am not just a one-trick-pony in all this. I install one thing at a time, and then verify that everything before that works. Then I move on to the next. SciPy, Matplotlab, etc. (My preference for plotting is gnuplot). So please understand that I am submitting this answer as a datapoint from a live 24x7 working system in an academic research environment. This is not a test environment - it is daily production.
    – SDsolar
    Dec 19 '17 at 8:05












  • Also, as I alluded to in a comment above, THINK PROFESSIONAL. These systems are in use by very high-level researchers all over the world. -->Make sure your boot drive has a clone before you make any major system upgrades. The dd command is quick and easy, and SATA connections are easy. There is no reason to avoid protecting your system. Just be careful that at each step you can revert any and all changes that might happen. Hard rives are a lot less expensive than your time. (unless you don't think that's true). Grant funds plus a time crunch should be enough incentive.
    – SDsolar
    Dec 19 '17 at 9:31













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
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',
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%2faskubuntu.com%2fquestions%2f748069%2fhow-do-i-switch-back-to-python2-after-anaconda-set-python3-as-the-default%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























5 Answers
5






active

oldest

votes








5 Answers
5






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
13
down vote



accepted










I went through the installation in a VM, and the following happend.




  1. The installer asks for an install location. Default is /home/myuser/anaconda3.


  2. At the end you'll be asked



    Python 3.5.1 :: Continuum Analytics, Inc.
    creating default environment...
    installation finished.
    Do you wish the installer to prepend the Anaconda3 install location
    to PATH in your /home/myuser/.bashrc ? [yes|no]
    [no] >>> yes

    Prepending PATH=/home/myuser/anaconda3/bin to PATH in /home/myuser/.bashrc
    A backup will be made to: /home/myuser/.bashrc-anaconda3.bak



To restore the old behavior, go to your home directory and do



mv .bashrc-anaconda3.bak .bashrc


then start a new shell.



As you suggest, you could alias python=python2, but I find that a bit weird.
I would




  1. Restore the original .bashrc

  2. Create (if it does not exist) ~/bin

  3. Link ln -s ~/anaconda3/bin/python3 ~/bin/python3

  4. [Prepend $HOME/bin to $PATH](Should already be set by default by ~/.profile)

  5. Relogin.


That way, calling python3 will start the one from Anaconda.




An important point is, that the original /usr/bin/python is still there, and still points to python2.7. The ramifications of having python->python3 in your path depend on how a specific script is called.

If the shebang #!/usr/bin/python is used, like it probably is in all executables that ship with Ubuntu, nothing will change.
On the other hand, for better portability #!/usr/bin/env python is sometimes used, which will now cause python3.5 to be called.






share|improve this answer



















  • 3




    "4. Prepend $HOME/bin to $PATH" .. already done by default ~/.profile - just a relogin is needed after creating ~/bin.
    – muru
    Mar 20 '16 at 11:15










  • @muru That's true, thanks. Added to the answer.
    – Nephente
    Mar 20 '16 at 11:28










  • okay, that worked, thanks! Just to put this into notice, that I had python 3.4.3 also installed previously (and pip and pip3 were both associated with it), now I have 2.7, 3.4, 3.5. Now I'm gonna re-install pip to point it to 3.5!
    – sinister
    Mar 20 '16 at 12:17










  • Anaconda comes with its own package manager called conda. It also manages virtual environments. I use that to install packages instead of pip.
    – Nephente
    Mar 20 '16 at 12:36








  • 1




    See stackoverflow.com/questions/20994716/…
    – Nephente
    Mar 20 '16 at 12:38















up vote
13
down vote



accepted










I went through the installation in a VM, and the following happend.




  1. The installer asks for an install location. Default is /home/myuser/anaconda3.


  2. At the end you'll be asked



    Python 3.5.1 :: Continuum Analytics, Inc.
    creating default environment...
    installation finished.
    Do you wish the installer to prepend the Anaconda3 install location
    to PATH in your /home/myuser/.bashrc ? [yes|no]
    [no] >>> yes

    Prepending PATH=/home/myuser/anaconda3/bin to PATH in /home/myuser/.bashrc
    A backup will be made to: /home/myuser/.bashrc-anaconda3.bak



To restore the old behavior, go to your home directory and do



mv .bashrc-anaconda3.bak .bashrc


then start a new shell.



As you suggest, you could alias python=python2, but I find that a bit weird.
I would




  1. Restore the original .bashrc

  2. Create (if it does not exist) ~/bin

  3. Link ln -s ~/anaconda3/bin/python3 ~/bin/python3

  4. [Prepend $HOME/bin to $PATH](Should already be set by default by ~/.profile)

  5. Relogin.


That way, calling python3 will start the one from Anaconda.




An important point is, that the original /usr/bin/python is still there, and still points to python2.7. The ramifications of having python->python3 in your path depend on how a specific script is called.

If the shebang #!/usr/bin/python is used, like it probably is in all executables that ship with Ubuntu, nothing will change.
On the other hand, for better portability #!/usr/bin/env python is sometimes used, which will now cause python3.5 to be called.






share|improve this answer



















  • 3




    "4. Prepend $HOME/bin to $PATH" .. already done by default ~/.profile - just a relogin is needed after creating ~/bin.
    – muru
    Mar 20 '16 at 11:15










  • @muru That's true, thanks. Added to the answer.
    – Nephente
    Mar 20 '16 at 11:28










  • okay, that worked, thanks! Just to put this into notice, that I had python 3.4.3 also installed previously (and pip and pip3 were both associated with it), now I have 2.7, 3.4, 3.5. Now I'm gonna re-install pip to point it to 3.5!
    – sinister
    Mar 20 '16 at 12:17










  • Anaconda comes with its own package manager called conda. It also manages virtual environments. I use that to install packages instead of pip.
    – Nephente
    Mar 20 '16 at 12:36








  • 1




    See stackoverflow.com/questions/20994716/…
    – Nephente
    Mar 20 '16 at 12:38













up vote
13
down vote



accepted







up vote
13
down vote



accepted






I went through the installation in a VM, and the following happend.




  1. The installer asks for an install location. Default is /home/myuser/anaconda3.


  2. At the end you'll be asked



    Python 3.5.1 :: Continuum Analytics, Inc.
    creating default environment...
    installation finished.
    Do you wish the installer to prepend the Anaconda3 install location
    to PATH in your /home/myuser/.bashrc ? [yes|no]
    [no] >>> yes

    Prepending PATH=/home/myuser/anaconda3/bin to PATH in /home/myuser/.bashrc
    A backup will be made to: /home/myuser/.bashrc-anaconda3.bak



To restore the old behavior, go to your home directory and do



mv .bashrc-anaconda3.bak .bashrc


then start a new shell.



As you suggest, you could alias python=python2, but I find that a bit weird.
I would




  1. Restore the original .bashrc

  2. Create (if it does not exist) ~/bin

  3. Link ln -s ~/anaconda3/bin/python3 ~/bin/python3

  4. [Prepend $HOME/bin to $PATH](Should already be set by default by ~/.profile)

  5. Relogin.


That way, calling python3 will start the one from Anaconda.




An important point is, that the original /usr/bin/python is still there, and still points to python2.7. The ramifications of having python->python3 in your path depend on how a specific script is called.

If the shebang #!/usr/bin/python is used, like it probably is in all executables that ship with Ubuntu, nothing will change.
On the other hand, for better portability #!/usr/bin/env python is sometimes used, which will now cause python3.5 to be called.






share|improve this answer














I went through the installation in a VM, and the following happend.




  1. The installer asks for an install location. Default is /home/myuser/anaconda3.


  2. At the end you'll be asked



    Python 3.5.1 :: Continuum Analytics, Inc.
    creating default environment...
    installation finished.
    Do you wish the installer to prepend the Anaconda3 install location
    to PATH in your /home/myuser/.bashrc ? [yes|no]
    [no] >>> yes

    Prepending PATH=/home/myuser/anaconda3/bin to PATH in /home/myuser/.bashrc
    A backup will be made to: /home/myuser/.bashrc-anaconda3.bak



To restore the old behavior, go to your home directory and do



mv .bashrc-anaconda3.bak .bashrc


then start a new shell.



As you suggest, you could alias python=python2, but I find that a bit weird.
I would




  1. Restore the original .bashrc

  2. Create (if it does not exist) ~/bin

  3. Link ln -s ~/anaconda3/bin/python3 ~/bin/python3

  4. [Prepend $HOME/bin to $PATH](Should already be set by default by ~/.profile)

  5. Relogin.


That way, calling python3 will start the one from Anaconda.




An important point is, that the original /usr/bin/python is still there, and still points to python2.7. The ramifications of having python->python3 in your path depend on how a specific script is called.

If the shebang #!/usr/bin/python is used, like it probably is in all executables that ship with Ubuntu, nothing will change.
On the other hand, for better portability #!/usr/bin/env python is sometimes used, which will now cause python3.5 to be called.







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 20 '16 at 11:36

























answered Mar 20 '16 at 10:59









Nephente

3,73611020




3,73611020








  • 3




    "4. Prepend $HOME/bin to $PATH" .. already done by default ~/.profile - just a relogin is needed after creating ~/bin.
    – muru
    Mar 20 '16 at 11:15










  • @muru That's true, thanks. Added to the answer.
    – Nephente
    Mar 20 '16 at 11:28










  • okay, that worked, thanks! Just to put this into notice, that I had python 3.4.3 also installed previously (and pip and pip3 were both associated with it), now I have 2.7, 3.4, 3.5. Now I'm gonna re-install pip to point it to 3.5!
    – sinister
    Mar 20 '16 at 12:17










  • Anaconda comes with its own package manager called conda. It also manages virtual environments. I use that to install packages instead of pip.
    – Nephente
    Mar 20 '16 at 12:36








  • 1




    See stackoverflow.com/questions/20994716/…
    – Nephente
    Mar 20 '16 at 12:38














  • 3




    "4. Prepend $HOME/bin to $PATH" .. already done by default ~/.profile - just a relogin is needed after creating ~/bin.
    – muru
    Mar 20 '16 at 11:15










  • @muru That's true, thanks. Added to the answer.
    – Nephente
    Mar 20 '16 at 11:28










  • okay, that worked, thanks! Just to put this into notice, that I had python 3.4.3 also installed previously (and pip and pip3 were both associated with it), now I have 2.7, 3.4, 3.5. Now I'm gonna re-install pip to point it to 3.5!
    – sinister
    Mar 20 '16 at 12:17










  • Anaconda comes with its own package manager called conda. It also manages virtual environments. I use that to install packages instead of pip.
    – Nephente
    Mar 20 '16 at 12:36








  • 1




    See stackoverflow.com/questions/20994716/…
    – Nephente
    Mar 20 '16 at 12:38








3




3




"4. Prepend $HOME/bin to $PATH" .. already done by default ~/.profile - just a relogin is needed after creating ~/bin.
– muru
Mar 20 '16 at 11:15




"4. Prepend $HOME/bin to $PATH" .. already done by default ~/.profile - just a relogin is needed after creating ~/bin.
– muru
Mar 20 '16 at 11:15












@muru That's true, thanks. Added to the answer.
– Nephente
Mar 20 '16 at 11:28




@muru That's true, thanks. Added to the answer.
– Nephente
Mar 20 '16 at 11:28












okay, that worked, thanks! Just to put this into notice, that I had python 3.4.3 also installed previously (and pip and pip3 were both associated with it), now I have 2.7, 3.4, 3.5. Now I'm gonna re-install pip to point it to 3.5!
– sinister
Mar 20 '16 at 12:17




okay, that worked, thanks! Just to put this into notice, that I had python 3.4.3 also installed previously (and pip and pip3 were both associated with it), now I have 2.7, 3.4, 3.5. Now I'm gonna re-install pip to point it to 3.5!
– sinister
Mar 20 '16 at 12:17












Anaconda comes with its own package manager called conda. It also manages virtual environments. I use that to install packages instead of pip.
– Nephente
Mar 20 '16 at 12:36






Anaconda comes with its own package manager called conda. It also manages virtual environments. I use that to install packages instead of pip.
– Nephente
Mar 20 '16 at 12:36






1




1




See stackoverflow.com/questions/20994716/…
– Nephente
Mar 20 '16 at 12:38




See stackoverflow.com/questions/20994716/…
– Nephente
Mar 20 '16 at 12:38












up vote
7
down vote













Good answer here:
https://stackoverflow.com/questions/24405561/how-to-install-2-anacondas-python-2-7-and-3-4-on-mac-os-10-9



conda create -n python2 python=2.7 anaconda


then, to switch:



source activate python2





share|improve this answer























  • If you need this you could very well have much deeper problems. If your system is important, do a full verification of any Python-dependent commands and/or utilities. Fair warning.
    – SDsolar
    Dec 19 '17 at 9:55















up vote
7
down vote













Good answer here:
https://stackoverflow.com/questions/24405561/how-to-install-2-anacondas-python-2-7-and-3-4-on-mac-os-10-9



conda create -n python2 python=2.7 anaconda


then, to switch:



source activate python2





share|improve this answer























  • If you need this you could very well have much deeper problems. If your system is important, do a full verification of any Python-dependent commands and/or utilities. Fair warning.
    – SDsolar
    Dec 19 '17 at 9:55













up vote
7
down vote










up vote
7
down vote









Good answer here:
https://stackoverflow.com/questions/24405561/how-to-install-2-anacondas-python-2-7-and-3-4-on-mac-os-10-9



conda create -n python2 python=2.7 anaconda


then, to switch:



source activate python2





share|improve this answer














Good answer here:
https://stackoverflow.com/questions/24405561/how-to-install-2-anacondas-python-2-7-and-3-4-on-mac-os-10-9



conda create -n python2 python=2.7 anaconda


then, to switch:



source activate python2






share|improve this answer














share|improve this answer



share|improve this answer








edited May 23 '17 at 12:39









Community

1




1










answered Oct 21 '16 at 21:18









Patrick Dolan

7111




7111












  • If you need this you could very well have much deeper problems. If your system is important, do a full verification of any Python-dependent commands and/or utilities. Fair warning.
    – SDsolar
    Dec 19 '17 at 9:55


















  • If you need this you could very well have much deeper problems. If your system is important, do a full verification of any Python-dependent commands and/or utilities. Fair warning.
    – SDsolar
    Dec 19 '17 at 9:55
















If you need this you could very well have much deeper problems. If your system is important, do a full verification of any Python-dependent commands and/or utilities. Fair warning.
– SDsolar
Dec 19 '17 at 9:55




If you need this you could very well have much deeper problems. If your system is important, do a full verification of any Python-dependent commands and/or utilities. Fair warning.
– SDsolar
Dec 19 '17 at 9:55










up vote
3
down vote













In case anyone is looking to change their python default version back to 2.7 after messing it up(by changing default one to: anaconda or python 3) and ending up with non-functional software, just follow this link: Link with instructions to change default python version.






share|improve this answer





















  • If a system change goes awry, be sure you can roll it back. Make sure you have good system image backups so any major changes can be reversed quickly if they don't go as you plan. Think professional. If you use amateur techniques then you can't expect professional results.
    – SDsolar
    Dec 19 '17 at 9:28












  • best answer! thanks.
    – Hridaynath
    Feb 9 at 11:23















up vote
3
down vote













In case anyone is looking to change their python default version back to 2.7 after messing it up(by changing default one to: anaconda or python 3) and ending up with non-functional software, just follow this link: Link with instructions to change default python version.






share|improve this answer





















  • If a system change goes awry, be sure you can roll it back. Make sure you have good system image backups so any major changes can be reversed quickly if they don't go as you plan. Think professional. If you use amateur techniques then you can't expect professional results.
    – SDsolar
    Dec 19 '17 at 9:28












  • best answer! thanks.
    – Hridaynath
    Feb 9 at 11:23













up vote
3
down vote










up vote
3
down vote









In case anyone is looking to change their python default version back to 2.7 after messing it up(by changing default one to: anaconda or python 3) and ending up with non-functional software, just follow this link: Link with instructions to change default python version.






share|improve this answer












In case anyone is looking to change their python default version back to 2.7 after messing it up(by changing default one to: anaconda or python 3) and ending up with non-functional software, just follow this link: Link with instructions to change default python version.







share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 15 '17 at 6:54









Ubdus Samad

1607




1607












  • If a system change goes awry, be sure you can roll it back. Make sure you have good system image backups so any major changes can be reversed quickly if they don't go as you plan. Think professional. If you use amateur techniques then you can't expect professional results.
    – SDsolar
    Dec 19 '17 at 9:28












  • best answer! thanks.
    – Hridaynath
    Feb 9 at 11:23


















  • If a system change goes awry, be sure you can roll it back. Make sure you have good system image backups so any major changes can be reversed quickly if they don't go as you plan. Think professional. If you use amateur techniques then you can't expect professional results.
    – SDsolar
    Dec 19 '17 at 9:28












  • best answer! thanks.
    – Hridaynath
    Feb 9 at 11:23
















If a system change goes awry, be sure you can roll it back. Make sure you have good system image backups so any major changes can be reversed quickly if they don't go as you plan. Think professional. If you use amateur techniques then you can't expect professional results.
– SDsolar
Dec 19 '17 at 9:28






If a system change goes awry, be sure you can roll it back. Make sure you have good system image backups so any major changes can be reversed quickly if they don't go as you plan. Think professional. If you use amateur techniques then you can't expect professional results.
– SDsolar
Dec 19 '17 at 9:28














best answer! thanks.
– Hridaynath
Feb 9 at 11:23




best answer! thanks.
– Hridaynath
Feb 9 at 11:23










up vote
1
down vote













This worked for me but for Miniconda, it should also work for Anaconda but please correct me if I'm wrong.



First get your $PATH variable:



echo $PATH


It will probably look like this (miniconda path before everything else):



/home/your_user/miniconda3/bin:$PATH


Copy that path to the bottom of your ~/.bashrc file, but with Miniconda at the end instead of the beginning of the path like so:



export PATH="$PATH:/home/your_user/miniconda3/bin"


The system will look for programs at the start of the $PATH variable before the miniconda3/bin folder.



It should restore the versions for previous programs you had like python.



Starting in Conda 4.4, they changed the code added to ~/.bashrc. Now, to achieve the same thing, edit ~/.bashrc and comment out the line below like so to prevent the base layer (base environment) from activating in every terminal. No need to touch any other part of the new additions. I am uncertain what significance CONDA_CHANGEPS1=false has, but haven't run into any issues so far.



   # CONDA_CHANGEPS1=false conda activate base


And while you won't see the conda folder in the path anymore, the conda command will still run fine, and your original python, python3, and pipenv commands will as well.






share|improve this answer























  • Upvote because I think you are correct. This is good to have in the database. However, can I please ask that you be a tad more specific as to version numbers of the software involved?
    – SDsolar
    Dec 19 '17 at 8:23










  • Thank you, and I don't really think that the program version matters, this should always work. At the time my installer was at the following version however: Miniconda3 4.3.14. Does that help?
    – ronalara
    Jan 12 at 22:03

















up vote
1
down vote













This worked for me but for Miniconda, it should also work for Anaconda but please correct me if I'm wrong.



First get your $PATH variable:



echo $PATH


It will probably look like this (miniconda path before everything else):



/home/your_user/miniconda3/bin:$PATH


Copy that path to the bottom of your ~/.bashrc file, but with Miniconda at the end instead of the beginning of the path like so:



export PATH="$PATH:/home/your_user/miniconda3/bin"


The system will look for programs at the start of the $PATH variable before the miniconda3/bin folder.



It should restore the versions for previous programs you had like python.



Starting in Conda 4.4, they changed the code added to ~/.bashrc. Now, to achieve the same thing, edit ~/.bashrc and comment out the line below like so to prevent the base layer (base environment) from activating in every terminal. No need to touch any other part of the new additions. I am uncertain what significance CONDA_CHANGEPS1=false has, but haven't run into any issues so far.



   # CONDA_CHANGEPS1=false conda activate base


And while you won't see the conda folder in the path anymore, the conda command will still run fine, and your original python, python3, and pipenv commands will as well.






share|improve this answer























  • Upvote because I think you are correct. This is good to have in the database. However, can I please ask that you be a tad more specific as to version numbers of the software involved?
    – SDsolar
    Dec 19 '17 at 8:23










  • Thank you, and I don't really think that the program version matters, this should always work. At the time my installer was at the following version however: Miniconda3 4.3.14. Does that help?
    – ronalara
    Jan 12 at 22:03















up vote
1
down vote










up vote
1
down vote









This worked for me but for Miniconda, it should also work for Anaconda but please correct me if I'm wrong.



First get your $PATH variable:



echo $PATH


It will probably look like this (miniconda path before everything else):



/home/your_user/miniconda3/bin:$PATH


Copy that path to the bottom of your ~/.bashrc file, but with Miniconda at the end instead of the beginning of the path like so:



export PATH="$PATH:/home/your_user/miniconda3/bin"


The system will look for programs at the start of the $PATH variable before the miniconda3/bin folder.



It should restore the versions for previous programs you had like python.



Starting in Conda 4.4, they changed the code added to ~/.bashrc. Now, to achieve the same thing, edit ~/.bashrc and comment out the line below like so to prevent the base layer (base environment) from activating in every terminal. No need to touch any other part of the new additions. I am uncertain what significance CONDA_CHANGEPS1=false has, but haven't run into any issues so far.



   # CONDA_CHANGEPS1=false conda activate base


And while you won't see the conda folder in the path anymore, the conda command will still run fine, and your original python, python3, and pipenv commands will as well.






share|improve this answer














This worked for me but for Miniconda, it should also work for Anaconda but please correct me if I'm wrong.



First get your $PATH variable:



echo $PATH


It will probably look like this (miniconda path before everything else):



/home/your_user/miniconda3/bin:$PATH


Copy that path to the bottom of your ~/.bashrc file, but with Miniconda at the end instead of the beginning of the path like so:



export PATH="$PATH:/home/your_user/miniconda3/bin"


The system will look for programs at the start of the $PATH variable before the miniconda3/bin folder.



It should restore the versions for previous programs you had like python.



Starting in Conda 4.4, they changed the code added to ~/.bashrc. Now, to achieve the same thing, edit ~/.bashrc and comment out the line below like so to prevent the base layer (base environment) from activating in every terminal. No need to touch any other part of the new additions. I am uncertain what significance CONDA_CHANGEPS1=false has, but haven't run into any issues so far.



   # CONDA_CHANGEPS1=false conda activate base


And while you won't see the conda folder in the path anymore, the conda command will still run fine, and your original python, python3, and pipenv commands will as well.







share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 3 at 16:19









Toruitas

32




32










answered May 18 '17 at 21:59









ronalara

114




114












  • Upvote because I think you are correct. This is good to have in the database. However, can I please ask that you be a tad more specific as to version numbers of the software involved?
    – SDsolar
    Dec 19 '17 at 8:23










  • Thank you, and I don't really think that the program version matters, this should always work. At the time my installer was at the following version however: Miniconda3 4.3.14. Does that help?
    – ronalara
    Jan 12 at 22:03




















  • Upvote because I think you are correct. This is good to have in the database. However, can I please ask that you be a tad more specific as to version numbers of the software involved?
    – SDsolar
    Dec 19 '17 at 8:23










  • Thank you, and I don't really think that the program version matters, this should always work. At the time my installer was at the following version however: Miniconda3 4.3.14. Does that help?
    – ronalara
    Jan 12 at 22:03


















Upvote because I think you are correct. This is good to have in the database. However, can I please ask that you be a tad more specific as to version numbers of the software involved?
– SDsolar
Dec 19 '17 at 8:23




Upvote because I think you are correct. This is good to have in the database. However, can I please ask that you be a tad more specific as to version numbers of the software involved?
– SDsolar
Dec 19 '17 at 8:23












Thank you, and I don't really think that the program version matters, this should always work. At the time my installer was at the following version however: Miniconda3 4.3.14. Does that help?
– ronalara
Jan 12 at 22:03






Thank you, and I don't really think that the program version matters, this should always work. At the time my installer was at the following version however: Miniconda3 4.3.14. Does that help?
– ronalara
Jan 12 at 22:03












up vote
0
down vote













Here is my answer, and it may or may not be the actual specific answer to what you have done to your own system.



However, I am in a similar situation and had the very same concern.



I am using Ubuntu 16.04 LTS and Python 2.7.12, and just recently installed Anaconda.



So now, when I go to the command line and type python it still goes to my Python2 installation.



Confirmed by this sequesnce:



$which python
/usr/bin/python < Catch-all for max compatibility
$python
Python 2.7.12 . . etc


So in my case, anaconda does NOT cause any problem with my default Python2 shebangs.



Ultimately, that is the question.



When you ask the system which python you can trust that to be correct string to use in the first line of your command-line style Python programs.



In my situation, all my same Python command-line script files continue to execute just fine.



I tend to write Python in a 3-compatible mode. Such as using parentheses around my print statements. But I am actively resisting a major change to the system that might cause hard-fought Python 2 programs to encounter glitches. Python 3 sounds great but unnecessary for my needs. Python 2 is an amazing language.



My computing environment does not allow me to go back and re-engineer past processes that have been tuned to work correctly without taking a mjor time hit since I would have to go back and figure out where I used it in the first place.





Bottom line for me: Upon install anaconda for future use, I have not had any speed bumps nor problems.





That is the point where I am in the process... Just finished re-certifying all the past software.





Next step is to actually use some of the cool stuff that is promised in the package.





So, I must suspect that other simply installing anaconda there must be more to your situation.



From my experience it is not a problem at all.






share|improve this answer























  • FYI, I have a complete Scientific workstation, working on solar dynamics. Also about ephemerals and satellite interactions. It MUST work. SO I am not just a one-trick-pony in all this. I install one thing at a time, and then verify that everything before that works. Then I move on to the next. SciPy, Matplotlab, etc. (My preference for plotting is gnuplot). So please understand that I am submitting this answer as a datapoint from a live 24x7 working system in an academic research environment. This is not a test environment - it is daily production.
    – SDsolar
    Dec 19 '17 at 8:05












  • Also, as I alluded to in a comment above, THINK PROFESSIONAL. These systems are in use by very high-level researchers all over the world. -->Make sure your boot drive has a clone before you make any major system upgrades. The dd command is quick and easy, and SATA connections are easy. There is no reason to avoid protecting your system. Just be careful that at each step you can revert any and all changes that might happen. Hard rives are a lot less expensive than your time. (unless you don't think that's true). Grant funds plus a time crunch should be enough incentive.
    – SDsolar
    Dec 19 '17 at 9:31

















up vote
0
down vote













Here is my answer, and it may or may not be the actual specific answer to what you have done to your own system.



However, I am in a similar situation and had the very same concern.



I am using Ubuntu 16.04 LTS and Python 2.7.12, and just recently installed Anaconda.



So now, when I go to the command line and type python it still goes to my Python2 installation.



Confirmed by this sequesnce:



$which python
/usr/bin/python < Catch-all for max compatibility
$python
Python 2.7.12 . . etc


So in my case, anaconda does NOT cause any problem with my default Python2 shebangs.



Ultimately, that is the question.



When you ask the system which python you can trust that to be correct string to use in the first line of your command-line style Python programs.



In my situation, all my same Python command-line script files continue to execute just fine.



I tend to write Python in a 3-compatible mode. Such as using parentheses around my print statements. But I am actively resisting a major change to the system that might cause hard-fought Python 2 programs to encounter glitches. Python 3 sounds great but unnecessary for my needs. Python 2 is an amazing language.



My computing environment does not allow me to go back and re-engineer past processes that have been tuned to work correctly without taking a mjor time hit since I would have to go back and figure out where I used it in the first place.





Bottom line for me: Upon install anaconda for future use, I have not had any speed bumps nor problems.





That is the point where I am in the process... Just finished re-certifying all the past software.





Next step is to actually use some of the cool stuff that is promised in the package.





So, I must suspect that other simply installing anaconda there must be more to your situation.



From my experience it is not a problem at all.






share|improve this answer























  • FYI, I have a complete Scientific workstation, working on solar dynamics. Also about ephemerals and satellite interactions. It MUST work. SO I am not just a one-trick-pony in all this. I install one thing at a time, and then verify that everything before that works. Then I move on to the next. SciPy, Matplotlab, etc. (My preference for plotting is gnuplot). So please understand that I am submitting this answer as a datapoint from a live 24x7 working system in an academic research environment. This is not a test environment - it is daily production.
    – SDsolar
    Dec 19 '17 at 8:05












  • Also, as I alluded to in a comment above, THINK PROFESSIONAL. These systems are in use by very high-level researchers all over the world. -->Make sure your boot drive has a clone before you make any major system upgrades. The dd command is quick and easy, and SATA connections are easy. There is no reason to avoid protecting your system. Just be careful that at each step you can revert any and all changes that might happen. Hard rives are a lot less expensive than your time. (unless you don't think that's true). Grant funds plus a time crunch should be enough incentive.
    – SDsolar
    Dec 19 '17 at 9:31















up vote
0
down vote










up vote
0
down vote









Here is my answer, and it may or may not be the actual specific answer to what you have done to your own system.



However, I am in a similar situation and had the very same concern.



I am using Ubuntu 16.04 LTS and Python 2.7.12, and just recently installed Anaconda.



So now, when I go to the command line and type python it still goes to my Python2 installation.



Confirmed by this sequesnce:



$which python
/usr/bin/python < Catch-all for max compatibility
$python
Python 2.7.12 . . etc


So in my case, anaconda does NOT cause any problem with my default Python2 shebangs.



Ultimately, that is the question.



When you ask the system which python you can trust that to be correct string to use in the first line of your command-line style Python programs.



In my situation, all my same Python command-line script files continue to execute just fine.



I tend to write Python in a 3-compatible mode. Such as using parentheses around my print statements. But I am actively resisting a major change to the system that might cause hard-fought Python 2 programs to encounter glitches. Python 3 sounds great but unnecessary for my needs. Python 2 is an amazing language.



My computing environment does not allow me to go back and re-engineer past processes that have been tuned to work correctly without taking a mjor time hit since I would have to go back and figure out where I used it in the first place.





Bottom line for me: Upon install anaconda for future use, I have not had any speed bumps nor problems.





That is the point where I am in the process... Just finished re-certifying all the past software.





Next step is to actually use some of the cool stuff that is promised in the package.





So, I must suspect that other simply installing anaconda there must be more to your situation.



From my experience it is not a problem at all.






share|improve this answer














Here is my answer, and it may or may not be the actual specific answer to what you have done to your own system.



However, I am in a similar situation and had the very same concern.



I am using Ubuntu 16.04 LTS and Python 2.7.12, and just recently installed Anaconda.



So now, when I go to the command line and type python it still goes to my Python2 installation.



Confirmed by this sequesnce:



$which python
/usr/bin/python < Catch-all for max compatibility
$python
Python 2.7.12 . . etc


So in my case, anaconda does NOT cause any problem with my default Python2 shebangs.



Ultimately, that is the question.



When you ask the system which python you can trust that to be correct string to use in the first line of your command-line style Python programs.



In my situation, all my same Python command-line script files continue to execute just fine.



I tend to write Python in a 3-compatible mode. Such as using parentheses around my print statements. But I am actively resisting a major change to the system that might cause hard-fought Python 2 programs to encounter glitches. Python 3 sounds great but unnecessary for my needs. Python 2 is an amazing language.



My computing environment does not allow me to go back and re-engineer past processes that have been tuned to work correctly without taking a mjor time hit since I would have to go back and figure out where I used it in the first place.





Bottom line for me: Upon install anaconda for future use, I have not had any speed bumps nor problems.





That is the point where I am in the process... Just finished re-certifying all the past software.





Next step is to actually use some of the cool stuff that is promised in the package.





So, I must suspect that other simply installing anaconda there must be more to your situation.



From my experience it is not a problem at all.







share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 19 '17 at 8:18

























answered Dec 19 '17 at 7:55









SDsolar

1,48941337




1,48941337












  • FYI, I have a complete Scientific workstation, working on solar dynamics. Also about ephemerals and satellite interactions. It MUST work. SO I am not just a one-trick-pony in all this. I install one thing at a time, and then verify that everything before that works. Then I move on to the next. SciPy, Matplotlab, etc. (My preference for plotting is gnuplot). So please understand that I am submitting this answer as a datapoint from a live 24x7 working system in an academic research environment. This is not a test environment - it is daily production.
    – SDsolar
    Dec 19 '17 at 8:05












  • Also, as I alluded to in a comment above, THINK PROFESSIONAL. These systems are in use by very high-level researchers all over the world. -->Make sure your boot drive has a clone before you make any major system upgrades. The dd command is quick and easy, and SATA connections are easy. There is no reason to avoid protecting your system. Just be careful that at each step you can revert any and all changes that might happen. Hard rives are a lot less expensive than your time. (unless you don't think that's true). Grant funds plus a time crunch should be enough incentive.
    – SDsolar
    Dec 19 '17 at 9:31




















  • FYI, I have a complete Scientific workstation, working on solar dynamics. Also about ephemerals and satellite interactions. It MUST work. SO I am not just a one-trick-pony in all this. I install one thing at a time, and then verify that everything before that works. Then I move on to the next. SciPy, Matplotlab, etc. (My preference for plotting is gnuplot). So please understand that I am submitting this answer as a datapoint from a live 24x7 working system in an academic research environment. This is not a test environment - it is daily production.
    – SDsolar
    Dec 19 '17 at 8:05












  • Also, as I alluded to in a comment above, THINK PROFESSIONAL. These systems are in use by very high-level researchers all over the world. -->Make sure your boot drive has a clone before you make any major system upgrades. The dd command is quick and easy, and SATA connections are easy. There is no reason to avoid protecting your system. Just be careful that at each step you can revert any and all changes that might happen. Hard rives are a lot less expensive than your time. (unless you don't think that's true). Grant funds plus a time crunch should be enough incentive.
    – SDsolar
    Dec 19 '17 at 9:31


















FYI, I have a complete Scientific workstation, working on solar dynamics. Also about ephemerals and satellite interactions. It MUST work. SO I am not just a one-trick-pony in all this. I install one thing at a time, and then verify that everything before that works. Then I move on to the next. SciPy, Matplotlab, etc. (My preference for plotting is gnuplot). So please understand that I am submitting this answer as a datapoint from a live 24x7 working system in an academic research environment. This is not a test environment - it is daily production.
– SDsolar
Dec 19 '17 at 8:05






FYI, I have a complete Scientific workstation, working on solar dynamics. Also about ephemerals and satellite interactions. It MUST work. SO I am not just a one-trick-pony in all this. I install one thing at a time, and then verify that everything before that works. Then I move on to the next. SciPy, Matplotlab, etc. (My preference for plotting is gnuplot). So please understand that I am submitting this answer as a datapoint from a live 24x7 working system in an academic research environment. This is not a test environment - it is daily production.
– SDsolar
Dec 19 '17 at 8:05














Also, as I alluded to in a comment above, THINK PROFESSIONAL. These systems are in use by very high-level researchers all over the world. -->Make sure your boot drive has a clone before you make any major system upgrades. The dd command is quick and easy, and SATA connections are easy. There is no reason to avoid protecting your system. Just be careful that at each step you can revert any and all changes that might happen. Hard rives are a lot less expensive than your time. (unless you don't think that's true). Grant funds plus a time crunch should be enough incentive.
– SDsolar
Dec 19 '17 at 9:31






Also, as I alluded to in a comment above, THINK PROFESSIONAL. These systems are in use by very high-level researchers all over the world. -->Make sure your boot drive has a clone before you make any major system upgrades. The dd command is quick and easy, and SATA connections are easy. There is no reason to avoid protecting your system. Just be careful that at each step you can revert any and all changes that might happen. Hard rives are a lot less expensive than your time. (unless you don't think that's true). Grant funds plus a time crunch should be enough incentive.
– SDsolar
Dec 19 '17 at 9:31




















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • 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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2faskubuntu.com%2fquestions%2f748069%2fhow-do-i-switch-back-to-python2-after-anaconda-set-python3-as-the-default%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

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕