简体   繁体   中英

Anaconda 2019.03: activate break in win10 git-bash

I've been using anaconda 2018.12 (conda 4.5.12) with git-bash in win10 system, and it works very well after I followed the following error message.

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If your shell is Bash or a Bourne variant, enable conda for the current user with

    $ echo ". C:\Users\user\Anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc

or, for all users, enable conda with

    $ sudo ln -s C:\Users\user\Anaconda3/etc/profile.d/conda.sh /etc/profile.d/conda.sh

The options above will permanently enable the 'conda' command, but they do NOT
put conda's base (root) environment on PATH.  To do so, run

    $ conda activate

in your terminal, or to put the base environment on PATH permanently, run

    $ echo "conda activate" >> ~/.bashrc

Previous to conda 4.4, the recommended way to activate conda was to modify PATH in
your ~/.bashrc file.  You should manually remove the line that looks like

    export PATH="C:\Users\user\Anaconda3/bin:$PATH"

^^^ The above line should NO LONGER be in your ~/.bashrc file! ^^^

But, after I upgraded anaconda to 2019.03 (conda 4.6.11) I got the following error message

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.

To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - cmd.exe
  - 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'.

By running conda init bash I got the following code in my .bash_profile

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
eval "$('C:\Users\user\Anaconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
# <<< conda initialize <<<

Then I got CommandNotFoundError: No command 'conda conda'. every time when I tried to use conda commend.

Conda does seem to work correctly in cmd.exe. Is anyone having the same problem here?

我使用 conda install conda=4.6.14 升级到 conda 4.6.14,此错误已为我解决。

I've solved this annoyance moving the added command below from ~\\.bash_profile to ~\\.bashrc and everything is working fine

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
eval "$('/c/Miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
# <<< conda initialize <<<

It looks like starting the terminal from VSCode does not run .bash_profile

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