If you want to be able to use conda in PowerShell, you need to add the conda scripts to your path. You can do this by running the following command in PowerShell:

1
$env:Path += ";C:\Users\USERNAME\Anaconda3\Scripts"

Next, you want to run Anaconda Prompt as administrator. You can do this by right-clicking on the Anaconda Prompt icon and selecting “Run as administrator”.

Execute the following command in Anaconda Prompt to register conda with PowerShell:

1
conda init powershell

Activate Conda in PowerShell

To activate conda, you can run the following command in PowerShell:

1
conda activate

Deactivate Conda in PowerShell

To deactivate conda, you can run the following command in PowerShell:

1
conda deactivate

Prevent Conda From Starting in PowerShell by Default

If you want to stop conda starting in PowerShell by default, you can run the following command in Anaconda Prompt:

1
conda config --set auto_activate_base false

Create a New Conda Environment

to create a new conda environment, you can run:

1
conda create --name myenv

Display an Active Conda Environment in PowerShell Prompt

If you want to display the active conda environment in PowerShell Prompt, you can use Oh My Posh.

Once installed, you can modify your *.omp.json file to add the following bit to your prompt. Please note that this works for the marcduiker theme I am using. You may need to modify it for your theme of choice:

Once done, it should look something like this:

PowerShell prompt with Conda environment enabled

Hope this helps!