I am just trying to activate conda virtual environment using python in linux. I am using subprocess module. It works fine when I used conda activate in terminal but this doesn't seem to work in pyhton. My code is
subprocess.run('conda activate ENV_NAME',shell=True)
but when I execute this simple code, got the following error
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
Please help me what should i do? Tried all solutions from stackoverflow but still getting the same error. Thanks!