Let’s keep this short but sweet, as it isn’t complicated and you don’t need the entire life story of Anaconda and PowerShell.
Prerequisites
Make sure that you have Anaconda set up on Windows, see https://docs.anaconda.com/anaconda/install/windows/
Make sure that you have installed PowerShell7, see https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-windows?view=powershell-7
Install guide
Open your Anaconda prompt (i.e. the command line, not the Navigator) and execute the command.
conda init powershell
This activates the PowerShell environment in the default PowerShell and creates a file at
%userprofile%\Documents\WindowsPowerShell\profile.ps1
When PowerShell starts a new shell it executes this script, however for PowerShell 7 the path has changed, so to get conda
working in PowerShell 7 you just need to copy the contents of this file to the appropriate file for PowerShell 7.
You can find your default profile path for PowerShell 7 by opening a PowerShell 7 prompt and issuing the command
echo $profile
This file probably won’t exist, so you need to create it. Call this [PS 7 Profile]
. Having created it copy the contents of
%userprofile%\Documents\WindowsPowerShell\profile.ps1
Into the [PS 7 Profile]
and restart PowerShell 7.
Now conda
works from PowerShell 7.