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?
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 .
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.
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.
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. "
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With