Conda Activate batch file

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:Anaconda3Scriptsconda.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:Anaconda3shellcondabinconda-hook.ps1' ; conda activate 'C:Anaconda3'

Expand snippet

And this is the contents of conda-hook.ps1

$Env:CONDA_EXE = "C:/Anaconda3Scriptsconda.exe"
$Env:_CE_M = ""
$Env:_CE_CONDA = ""
$Env:_CONDA_ROOT = "C:/Anaconda3"
$Env:_CONDA_EXE = "C:/Anaconda3Scriptsconda.exe"
$CondaModuleArgs = @{ChangePs1 = $True}
Import-Module "$Env:_CONDA_ROOTshellcondabinConda.psm1" -ArgumentList $CondaModuleArgs

Remove-Variable CondaModuleArgs

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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:Anaconda3Scripts"
call C:Anaconda3Scriptsactivate.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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x