2

I installed Miniconda 3, then I tried to run python python -i. Because python didn't work. the next warning appeared

Warning: This Python interpreter is in a conda environment, but the environment has not been activated. Libraries may fail to load. To activate this environment please see https://conda.io/activation

So, I went on to activate it, using source /c/Users/myUserName/Miniconda3/Scripts/activate base , and ran python again, it worked well.

But each time I close the terminal and open it again, the same warning message appears, which has me to activate the environment again.

What am I missing?

Rami Ma
  • 966
  • 1
  • 7
  • 13
  • 1
    Are you using windows subsystem for linux? (I'm guessing from your path name). If you are.. you can edit `~/.bashrc` and place the command you need to run at the bottom of that file. (`source /c/Users/myUserName/Miniconda3/Scripts/activate base`). The `~/.bashrc` file will be run every time you open a terminal. If you're unfamiliar, you can usually use `nano` for quick edits. ie: `nano ~/.bashrc` then make your changes. – SyntaxVoid Nov 14 '19 at 22:29
  • 2
    Thank you so much it's exactly what I needed. Actually, I'm using windows but with the terminal of linux (GitBash terminal). I typed `nano ~/.bashrc` and add `source /c/Users/myUserName/Miniconda3/Scripts/activate base`. Everything turned to be okey. Can you please make it as an answer (not a comment), so I can accept it @SyntaxVoid – Rami Ma Nov 14 '19 at 22:50
  • Rather than manually editing `.bashrc`, better practice is to use `conda init bash` which will edit `.bashrc` for you. See [How to Run Conda?](https://stackoverflow.com/a/55526573/570918) – merv Nov 15 '19 at 01:00

1 Answers1

1

If you want a command to be executed every time you open your terminal, you can add the command to the bottom of your ~/.bashrc file.

A relatively easy way to do this uses the builtin nano text-editor. From terminal, run

nano ~/.bashrc

and then scroll down to the bottom. The idea of adding your own stuff to the bottom is good practice, as you shouldn't really change the 'default' content generated by your OS unless you really know what you're doing.

Type in the command you want to execute every time terminal starts up which is

source /c/Users/myUserName/Miniconda3/Scripts/activate base

in your case. Then save with ctrl+o then enter. Then exit with ctrl+x

Now restart your terminal or run source ~/.bashrc to see the effects.

SyntaxVoid
  • 2,501
  • 2
  • 15
  • 23