conda激活环境:CommandNotFoundError: Your shell has not been properly configured to use ‘conda activate‘

在Ubuntu18.04终端想激活一个conda虚拟环境时,输入命令conda activate gluon时出现错误提示:

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'.

但如果是用source activate gluon就能正常激活,反复几次之后发现每次重启终端都需要用source才能激活,用过source之后的同一个终端下才能用conda激活。

随后根据报错提示,重新配置conda的shell环境(本文用的是bash):conda init bash

执行命令后:

tsy@tsy-OMEN-Laptop-15-ek0xxx:~$ conda init bash
no change     /home/tsy/anaconda3/condabin/conda
no change     /home/tsy/anaconda3/bin/conda
no change     /home/tsy/anaconda3/bin/conda-env
no change     /home/tsy/anaconda3/bin/activate
no change     /home/tsy/anaconda3/bin/deactivate
no change     /home/tsy/anaconda3/etc/profile.d/conda.sh
no change     /home/tsy/anaconda3/etc/fish/conf.d/conda.fish
no change     /home/tsy/anaconda3/shell/condabin/Conda.psm1
no change     /home/tsy/anaconda3/shell/condabin/conda-hook.ps1
no change     /home/tsy/anaconda3/lib/python3.6/site-packages/xontrib/conda.xsh
no change     /home/tsy/anaconda3/etc/profile.d/conda.csh
modified      /home/tsy/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

重启终端后,默认环境会显示是base,然后再执行conda activate gluon就能正常激活啦!

(base) tsy@tsy-OMEN-Laptop-15-ek0xxx:~$ conda activate gluon
(gluon) tsy@tsy-OMEN-Laptop-15-ek0xxx:~$ 
  • 7
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值