Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set Anaconda's python as my default python command?

I have both Anaconda and Python 2.7 installed on my Windows machine. Right now the command "python" points to Python 2.7, but I'd like instead for it to point to Anaconda's python. How do I set this up?

like image 566
user2192778 Avatar asked Mar 18 '16 02:03

user2192778


People also ask

How do I change the default version of Python in CMD?

Always type py instead of python when running a script from the command line. Set your preferred default version by setting the PY_PYTHON environment variable (e.g. PY_PYTHON=3.7) . You can see what version of python is your default by typing py .

Should I register anaconda3 as my default Python?

Unless you plan on installing and running multiple versions of Anaconda or multiple versions of Python, accept the default and leave this box checked. Instead, use Anaconda software by opening Anaconda Navigator or the Anaconda Prompt from the Start Menu.


2 Answers

Your PATH is pointing to the original Python executable. You have to update your PATH.

(Assuming Windows 7)

Right-click on Computer, the Properties, the Advanced system settings, then click the Environment Variables... button.

The lower window has the system variables. Scroll down until you find Path, select it, and click edit. In the screen that appears, update the path that is pointing to your original python.exe to the one that is in the anaconda path.

Close any open command window for update to take effect.

like image 189
Jason Strimpel Avatar answered Oct 21 '22 20:10

Jason Strimpel


From the docs (https://docs.anaconda.com/anaconda/user-guide/

source <path to conda>/bin/activate
conda init

" Should I add Anaconda to the macOS or Linux PATH?

We do not recommend adding Anaconda to the PATH manually. During installation, you will be asked “Do you wish the installer to initialize Anaconda3 by running conda init?” We recommend “yes”. If you enter “no”, then conda will not modify your shell scripts at all. In order to initialize after the installation process is done, first run source /bin/activate and then run conda init. "

like image 36
jabberwocky Avatar answered Oct 21 '22 18:10

jabberwocky