简体   繁体   中英

conda activate fails but the shell prompt has changed

I am using conda==4.6.2 .

When I do conda activate xx , the prompt of the shell has been changed to be prefixed with (xx) , but when I type which python , the python is still the python of the base environment.

The behaviour is not reproducible. It occurs sometimes but not always. But it is very annoying that sometimes something fails because the conda does not switch the environment.

Does anyone happen to suffer from it, either?

Does anyone know how to fix it?

Note: The problem actually occurs in conda==4.5 too.

I have figured it out:

  • To use conda , the path of base environment is in my PATH , like export PATH="/miniconda/bin:$PATH"

  • I activated conda , which adds the path of xx environment to PATH , now PATH is /miniconda/envs/xx/bin:/miniconda/bin

  • I do something like invoke a zsh , which again add the path of base environmen in my PATH , now PATH is /miniconda/bin:/miniconda/envs/xx/bin:/miniconda/bin

  • I activated conda , which only modifies the prompt of zsh . So when I invoke python , it is the python of the base environment.

This is a change introduced in conda==4.6.3 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM