I am trying to install anaconda alongside python, without having anaconda on path. I created a batch script that worked yesterday but not today for some reason.
@echo off
C:\Anaconda3\Scripts\conda.exe
I named it conda-activate and when I entered conda activate it opened the base environment. Now it doesn't.
Here is a script that works for powershell:
& 'C:\Anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\Anaconda3'
Expand snippet
And this is the contents of conda-hook.ps1
$Env:CONDA_EXE = "C:/Anaconda3\Scripts\conda.exe"
$Env:_CE_M = ""
$Env:_CE_CONDA = ""
$Env:_CONDA_ROOT = "C:/Anaconda3"
$Env:_CONDA_EXE = "C:/Anaconda3\Scripts\conda.exe"
$CondaModuleArgs = @{ChangePs1 = $True}
Import-Module "$Env:_CONDA_ROOT\shell\condabin\Conda.psm1" -ArgumentList $CondaModuleArgs
Remove-Variable CondaModuleArgs
CodePudding user response:
I'm really not sure if this is related or not because I don't have much of backround knowledge. you tell me...
I wrote a batch file starting jupyter notebook for me. I googled around back then and came out with this:
cd /d "C:\Anaconda3\Scripts\"
call C:\Anaconda3\Scripts\activate.bat
jupyter notebook --notebook-dir="C:\Python"
So when trying to activate your conda environment, your need to change directory with cd
and call the activate.bat
file