I have a remote machine with a conda environment. I'd like to always have conda when starting up powershell.
I know it's done by conda init powershell
. But that only works when I directly open powershell after remoting to the machine. It does not work when using Enter-PSSession
on my local to connect to the remote machine.
How can I do it? Thank you
You can add a command to be executed on startup to Enter-PSSession
. With that, you can initialize conda and activate base (or another env). Example for activating base:
Enter-PSSession -Command "& 'C:\ProgramData\anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\ProgramData\anaconda3' "
Adjust C:\ProgramData\anaconda3
to your path to your conda base, or the directory of another env