Home > database >  How do I conda init if I don't have permission to edit my .bashrc file
How do I conda init if I don't have permission to edit my .bashrc file

Time:01-29

I have installed miniconda3. /full/path/to/bin/conda init -d shows only my .bashrc will be modified. Is there a way to write the contents of conda init to a separate file called init_conda.sh, which can be sourced when required?

CodePudding user response:

One can grab the actual code Conda would insert by adding a verbosity flag to the command:

/full/path/to/bin/conda init -d -v

And you can put that code (after removing the " " that starting the lines, because it's a patch file output) in a file of your choice. Note that if you have a writable ~/.bash_profile, that could be an alternative to .bashrc, and that would still be loaded by default in interactive bash sessions.

Another alternative is to use Conda's hardcoded initialization file. It should be found at:

${CONDA_PREFIX}/etc/profile.d/conda.sh

So, you might consider having an alias to source that, or create a softlink to it in a more memorable location.

  • Related