Adding Anaconda to Path or not
UPDATE
Current Anaconda installations offer an "Anaconda Prompt" that has conda
on the path. Go to the Windows start button (Window icon) and start typing anaconda
. You should see an entry "Anaconda Prompt". Click on it. A new window opens that has conda
in the search path. Use as many Anaconda prompts as needed.
Old Answer
A good way is to work with conda
environments.
Add the path where the
conda.exe
to thePATH
temporally:set PATH=C:\my\path\to\conda;%PATH%
Create a new environment:
conda create -n py36 python=3.6
Activate it:
activate py36
Now the prompt should change to py36
and all should work since all needed paths are set. You need to install all your packages you need for your project while this environment is activated. When done deactivate it with deactivate
.
Related videos on Youtube
Xaser
Updated on June 16, 2021Comments
-
Xaser almost 3 years
The official recommendation is not to add Anaconda / Python to the Windows
PATH
environment variable (see Anaconda User Guide FAQ). But how can I ensure then that my custom build scripts find python? (e.g. mysphinx
make.bat
). -
charlie80 over 6 yearsbut should I endure this pain every time I want a quick python/ipython/jupyter session? Any suggestions on making this more practical?
-
Mike Müller over 6 yearsOnce you created the environment, you can write a file
myenv.bat
with this content:set PATH=C:\my\path\to\conda;%PATH% & activate py36
and activate your environment withmyenv
. -
Craig Brett over 6 yearsI still don't really get why having conda on the path is such a bad thing. I suppose if you've got various different versions of conda for whatever nefarious reason, but is that the dominant case?
-
Mike Müller over 6 yearsThere is no problem with
conda
. But it also putspython
on thePATH
. This might interfere with other installed programs that use a different, already installed Python version. -
msarahan about 6 yearsIf you install the "console_shortcut" package, you get a start menu entry that is a shortcut to drop you into an activated shell. You get one shortcut for each environment that you install "console_shortcut" into.
-
Craig Brett about 6 yearsI still maintain it's more of a pain to not have it on the path and have to either use the "special" anaconda prompt or keep adding it to the path manually. That and having user specific paths means that a team wide script to set up a prefix virtualenv for a project is impractical, as everyone's conda install location may be different. If there's a way around that particular use case, then maybe I can get over having commands usefully on the path
-
Mike Müller about 6 years@CraigBrett Indeed there is a better way now. Updated my answer.