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:
|
|
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:
|
|
Activate Conda in PowerShell
To activate conda, you can run the following command in PowerShell:
|
|
Deactivate Conda in PowerShell
To deactivate conda, you can run the following command in PowerShell:
|
|
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:
|
|
Create a New Conda Environment
to create a new conda environment, you can run:
|
|
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:
Hope this helps!