How to set anaconda as a default python?












7















I have just installed the Anaconda (for ipython notebook -- wanted to run some pandas programme). It is installed successfully but the problem here is whenever I type which python, it is always using a default python as /usr/bin/python



It will be great if someone can tell me how to setup the anaconda python as a default python. I am noob here till now I have just installed the anaconda in the default path as following ~/anaconda3.



Thanks in advance.










share|improve this question





























    7















    I have just installed the Anaconda (for ipython notebook -- wanted to run some pandas programme). It is installed successfully but the problem here is whenever I type which python, it is always using a default python as /usr/bin/python



    It will be great if someone can tell me how to setup the anaconda python as a default python. I am noob here till now I have just installed the anaconda in the default path as following ~/anaconda3.



    Thanks in advance.










    share|improve this question



























      7












      7








      7


      6






      I have just installed the Anaconda (for ipython notebook -- wanted to run some pandas programme). It is installed successfully but the problem here is whenever I type which python, it is always using a default python as /usr/bin/python



      It will be great if someone can tell me how to setup the anaconda python as a default python. I am noob here till now I have just installed the anaconda in the default path as following ~/anaconda3.



      Thanks in advance.










      share|improve this question
















      I have just installed the Anaconda (for ipython notebook -- wanted to run some pandas programme). It is installed successfully but the problem here is whenever I type which python, it is always using a default python as /usr/bin/python



      It will be great if someone can tell me how to setup the anaconda python as a default python. I am noob here till now I have just installed the anaconda in the default path as following ~/anaconda3.



      Thanks in advance.







      14.04 python3 paths anaconda






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 20 '17 at 2:48









      wjandrea

      9,28942664




      9,28942664










      asked Feb 24 '17 at 20:09









      yogesh Ratudiyogesh Ratudi

      36113




      36113






















          3 Answers
          3






          active

          oldest

          votes


















          8














          I have the same setup as you desire. In my case the anaconda installer added an entry in my ~/.bashrc file. I don't know why yours did not. So to get to do what you want, add this to your ~/.bashrc file:



          export PATH="/home/yash/anaconda3/bin:$PATH"


          You need to refresh your env variables after this by opening a new terminal or using source ~/.bashrc



          With this:



          $ which python
          /home/yash/anaconda3/bin/python


          And python -v returns: anaconda



          To get back to the former default, I comment out the entry setting the pathbin the .bashrc file and get these results:



          $ which python
          /usr/bin/python
          $ python -v
          python 2.7.*





          share|improve this answer





















          • 2





            That's fine, ofc. But I'd suggest using environments, that way you can create as many python envs as you want and switch between them using source activate/deactivate: conda.io/docs/using/envs.html

            – Samuel Santana
            Feb 24 '17 at 21:17











          • I have the above added to ~/.bashrc however which python does not return the anaconda3 version..... do I need to reboot for it to take effect? Just installed anaconda.

            – user391339
            Feb 23 '18 at 19:37











          • # added by Anaconda3 installer export PATH="/home/d/anaconda3/bin:$PATH"

            – user391339
            Feb 23 '18 at 19:38






          • 1





            Ah, I got it. You need to refresh the environment variables either by re-opening a new terminal or typing source ~/.bashrc

            – user391339
            Feb 23 '18 at 19:40






          • 1





            thanks! this answer saved my day!

            – Jinhua Wang
            yesterday



















          2














          Instead of adding the entry in ~/.bashrc add the entry in ~/.profile or ~/.bash_profile as it is a path and not an alias. Also, adding the path in bashrc may slower the terminal unnecessarily. To know the detailed meaning of ~/.bashrc and it's difference with the profile visit this link.






          share|improve this answer































            0














            After you installed Anaconda, just run



            source ~/.bashrc


            If you open the .bashrc file you can see it added Anaconda python to environment variable.






            share|improve this answer








            New contributor




            byrony is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.




















              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',
              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%2faskubuntu.com%2fquestions%2f886983%2fhow-to-set-anaconda-as-a-default-python%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              8














              I have the same setup as you desire. In my case the anaconda installer added an entry in my ~/.bashrc file. I don't know why yours did not. So to get to do what you want, add this to your ~/.bashrc file:



              export PATH="/home/yash/anaconda3/bin:$PATH"


              You need to refresh your env variables after this by opening a new terminal or using source ~/.bashrc



              With this:



              $ which python
              /home/yash/anaconda3/bin/python


              And python -v returns: anaconda



              To get back to the former default, I comment out the entry setting the pathbin the .bashrc file and get these results:



              $ which python
              /usr/bin/python
              $ python -v
              python 2.7.*





              share|improve this answer





















              • 2





                That's fine, ofc. But I'd suggest using environments, that way you can create as many python envs as you want and switch between them using source activate/deactivate: conda.io/docs/using/envs.html

                – Samuel Santana
                Feb 24 '17 at 21:17











              • I have the above added to ~/.bashrc however which python does not return the anaconda3 version..... do I need to reboot for it to take effect? Just installed anaconda.

                – user391339
                Feb 23 '18 at 19:37











              • # added by Anaconda3 installer export PATH="/home/d/anaconda3/bin:$PATH"

                – user391339
                Feb 23 '18 at 19:38






              • 1





                Ah, I got it. You need to refresh the environment variables either by re-opening a new terminal or typing source ~/.bashrc

                – user391339
                Feb 23 '18 at 19:40






              • 1





                thanks! this answer saved my day!

                – Jinhua Wang
                yesterday
















              8














              I have the same setup as you desire. In my case the anaconda installer added an entry in my ~/.bashrc file. I don't know why yours did not. So to get to do what you want, add this to your ~/.bashrc file:



              export PATH="/home/yash/anaconda3/bin:$PATH"


              You need to refresh your env variables after this by opening a new terminal or using source ~/.bashrc



              With this:



              $ which python
              /home/yash/anaconda3/bin/python


              And python -v returns: anaconda



              To get back to the former default, I comment out the entry setting the pathbin the .bashrc file and get these results:



              $ which python
              /usr/bin/python
              $ python -v
              python 2.7.*





              share|improve this answer





















              • 2





                That's fine, ofc. But I'd suggest using environments, that way you can create as many python envs as you want and switch between them using source activate/deactivate: conda.io/docs/using/envs.html

                – Samuel Santana
                Feb 24 '17 at 21:17











              • I have the above added to ~/.bashrc however which python does not return the anaconda3 version..... do I need to reboot for it to take effect? Just installed anaconda.

                – user391339
                Feb 23 '18 at 19:37











              • # added by Anaconda3 installer export PATH="/home/d/anaconda3/bin:$PATH"

                – user391339
                Feb 23 '18 at 19:38






              • 1





                Ah, I got it. You need to refresh the environment variables either by re-opening a new terminal or typing source ~/.bashrc

                – user391339
                Feb 23 '18 at 19:40






              • 1





                thanks! this answer saved my day!

                – Jinhua Wang
                yesterday














              8












              8








              8







              I have the same setup as you desire. In my case the anaconda installer added an entry in my ~/.bashrc file. I don't know why yours did not. So to get to do what you want, add this to your ~/.bashrc file:



              export PATH="/home/yash/anaconda3/bin:$PATH"


              You need to refresh your env variables after this by opening a new terminal or using source ~/.bashrc



              With this:



              $ which python
              /home/yash/anaconda3/bin/python


              And python -v returns: anaconda



              To get back to the former default, I comment out the entry setting the pathbin the .bashrc file and get these results:



              $ which python
              /usr/bin/python
              $ python -v
              python 2.7.*





              share|improve this answer















              I have the same setup as you desire. In my case the anaconda installer added an entry in my ~/.bashrc file. I don't know why yours did not. So to get to do what you want, add this to your ~/.bashrc file:



              export PATH="/home/yash/anaconda3/bin:$PATH"


              You need to refresh your env variables after this by opening a new terminal or using source ~/.bashrc



              With this:



              $ which python
              /home/yash/anaconda3/bin/python


              And python -v returns: anaconda



              To get back to the former default, I comment out the entry setting the pathbin the .bashrc file and get these results:



              $ which python
              /usr/bin/python
              $ python -v
              python 2.7.*






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Feb 23 '18 at 22:46









              user391339

              3712617




              3712617










              answered Feb 24 '17 at 20:58









              George UdosenGeorge Udosen

              21.2k94570




              21.2k94570








              • 2





                That's fine, ofc. But I'd suggest using environments, that way you can create as many python envs as you want and switch between them using source activate/deactivate: conda.io/docs/using/envs.html

                – Samuel Santana
                Feb 24 '17 at 21:17











              • I have the above added to ~/.bashrc however which python does not return the anaconda3 version..... do I need to reboot for it to take effect? Just installed anaconda.

                – user391339
                Feb 23 '18 at 19:37











              • # added by Anaconda3 installer export PATH="/home/d/anaconda3/bin:$PATH"

                – user391339
                Feb 23 '18 at 19:38






              • 1





                Ah, I got it. You need to refresh the environment variables either by re-opening a new terminal or typing source ~/.bashrc

                – user391339
                Feb 23 '18 at 19:40






              • 1





                thanks! this answer saved my day!

                – Jinhua Wang
                yesterday














              • 2





                That's fine, ofc. But I'd suggest using environments, that way you can create as many python envs as you want and switch between them using source activate/deactivate: conda.io/docs/using/envs.html

                – Samuel Santana
                Feb 24 '17 at 21:17











              • I have the above added to ~/.bashrc however which python does not return the anaconda3 version..... do I need to reboot for it to take effect? Just installed anaconda.

                – user391339
                Feb 23 '18 at 19:37











              • # added by Anaconda3 installer export PATH="/home/d/anaconda3/bin:$PATH"

                – user391339
                Feb 23 '18 at 19:38






              • 1





                Ah, I got it. You need to refresh the environment variables either by re-opening a new terminal or typing source ~/.bashrc

                – user391339
                Feb 23 '18 at 19:40






              • 1





                thanks! this answer saved my day!

                – Jinhua Wang
                yesterday








              2




              2





              That's fine, ofc. But I'd suggest using environments, that way you can create as many python envs as you want and switch between them using source activate/deactivate: conda.io/docs/using/envs.html

              – Samuel Santana
              Feb 24 '17 at 21:17





              That's fine, ofc. But I'd suggest using environments, that way you can create as many python envs as you want and switch between them using source activate/deactivate: conda.io/docs/using/envs.html

              – Samuel Santana
              Feb 24 '17 at 21:17













              I have the above added to ~/.bashrc however which python does not return the anaconda3 version..... do I need to reboot for it to take effect? Just installed anaconda.

              – user391339
              Feb 23 '18 at 19:37





              I have the above added to ~/.bashrc however which python does not return the anaconda3 version..... do I need to reboot for it to take effect? Just installed anaconda.

              – user391339
              Feb 23 '18 at 19:37













              # added by Anaconda3 installer export PATH="/home/d/anaconda3/bin:$PATH"

              – user391339
              Feb 23 '18 at 19:38





              # added by Anaconda3 installer export PATH="/home/d/anaconda3/bin:$PATH"

              – user391339
              Feb 23 '18 at 19:38




              1




              1





              Ah, I got it. You need to refresh the environment variables either by re-opening a new terminal or typing source ~/.bashrc

              – user391339
              Feb 23 '18 at 19:40





              Ah, I got it. You need to refresh the environment variables either by re-opening a new terminal or typing source ~/.bashrc

              – user391339
              Feb 23 '18 at 19:40




              1




              1





              thanks! this answer saved my day!

              – Jinhua Wang
              yesterday





              thanks! this answer saved my day!

              – Jinhua Wang
              yesterday













              2














              Instead of adding the entry in ~/.bashrc add the entry in ~/.profile or ~/.bash_profile as it is a path and not an alias. Also, adding the path in bashrc may slower the terminal unnecessarily. To know the detailed meaning of ~/.bashrc and it's difference with the profile visit this link.






              share|improve this answer




























                2














                Instead of adding the entry in ~/.bashrc add the entry in ~/.profile or ~/.bash_profile as it is a path and not an alias. Also, adding the path in bashrc may slower the terminal unnecessarily. To know the detailed meaning of ~/.bashrc and it's difference with the profile visit this link.






                share|improve this answer


























                  2












                  2








                  2







                  Instead of adding the entry in ~/.bashrc add the entry in ~/.profile or ~/.bash_profile as it is a path and not an alias. Also, adding the path in bashrc may slower the terminal unnecessarily. To know the detailed meaning of ~/.bashrc and it's difference with the profile visit this link.






                  share|improve this answer













                  Instead of adding the entry in ~/.bashrc add the entry in ~/.profile or ~/.bash_profile as it is a path and not an alias. Also, adding the path in bashrc may slower the terminal unnecessarily. To know the detailed meaning of ~/.bashrc and it's difference with the profile visit this link.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 5 '18 at 13:19









                  Paramjeet DesaiParamjeet Desai

                  211




                  211























                      0














                      After you installed Anaconda, just run



                      source ~/.bashrc


                      If you open the .bashrc file you can see it added Anaconda python to environment variable.






                      share|improve this answer








                      New contributor




                      byrony is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.

























                        0














                        After you installed Anaconda, just run



                        source ~/.bashrc


                        If you open the .bashrc file you can see it added Anaconda python to environment variable.






                        share|improve this answer








                        New contributor




                        byrony is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.























                          0












                          0








                          0







                          After you installed Anaconda, just run



                          source ~/.bashrc


                          If you open the .bashrc file you can see it added Anaconda python to environment variable.






                          share|improve this answer








                          New contributor




                          byrony is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.










                          After you installed Anaconda, just run



                          source ~/.bashrc


                          If you open the .bashrc file you can see it added Anaconda python to environment variable.







                          share|improve this answer








                          New contributor




                          byrony is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          share|improve this answer



                          share|improve this answer






                          New contributor




                          byrony is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          answered 7 hours ago









                          byronybyrony

                          101




                          101




                          New contributor




                          byrony is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.





                          New contributor





                          byrony is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






                          byrony is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






























                              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.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f886983%2fhow-to-set-anaconda-as-a-default-python%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

                              GameSpot

                              connect to host localhost port 22: Connection refused

                              Getting a Wifi WPA2 wifi connection