How to activate different anaconda environment from powershell

Hector Barbossa picture Hector Barbossa · Dec 13, 2017 · Viewed 35.2k times · Source

I have two environments in anaconda, namely: root, 2env. When I open anaconda prompt, I can switch from root to 2env by typing: activate 2env. I also have conda in my powershell, but when I open powershell and try to run conda activate 2env it gives the following error:

CommandNotFoundError: 'activate'

Any suggestions on how to fix this?

Answer

Seanny123 picture Seanny123 · Feb 21, 2019

Although Conda previously did not support PowerShell, this is now resolved in Conda 4.6.

After adding Anaconda3/Scripts/ to your PATH variable, you should be able to initialize Conda for use with powershell with:

conda init powershell

Afterwards, you can use conda normally:

conda activate base