Start terminal with previous conda environment

Is there a way to start up the terminal with the previously run conda environment instead of having to activate it on every startup? Setting up a default environment doesn’t really help since if the environment you set as your default environment isn’t the one you had for your previous session, you still have to activate it.

1 Like

dear albasfaisal

nice to meet you.

It’s easy.

for example,

Create the Conda environment with the conda create command. The following command creates a Python 3.6 environment with the name py36.

(base) $ conda create --name py36 python = 3.6

Activate the created environment with the conda activate environment name.

(base) $ conda activate py36
(py36) $

When you switch the Conda environment, the prompt display also switches from (base) to (py36).

Regards, you.

I am not sure whether there is any way to do it natively, but you could always place a conda activate line in your .bashrc or similar file, depending on your OS/shell preferences.

1 Like

Thanks :wink:

Okay, I’m here anyhow to learn. And there’s much forgotten. ;
The Tutorial is fine and won’t hurt.

1 Like