MAC 切换到zsh后conda命令失效

方法1:编辑.zshrc文件, 添加conda路径。

  1. 我是从pychram中发现conda的路径的。在Preferences --> Project Interpreter --> 上面是现在使用的Interpreter, 点击旁边的三个点的按钮然后点击 add --> 选择 Conda Environment --> 在Exisiting environment 中会发现你anaconda的路径。我的在/opt/anaconda3
  2. 编辑.zshrc 文件, 添加 export PATH=/opt/anaconda3/bin:$PATH
  3. source ~/.zshrc 之后 conda 命令就可以使用了
  4. 终端输入 cconda init zsh

方法2:直接复制bash中的配置到 .zshrc

  1. .bash_profile中复制conda相关的内容,粘贴到.zshrc中,也就是下面的内容
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
 __conda_setup="$('/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
 if [ $? -eq 0 ]; then
     eval "$__conda_setup"
 else
     if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
         . "/opt/anaconda3/etc/profile.d/conda.sh"
     else
         export PATH="/opt/anaconda3/bin:$PATH"
     fi
 fi
 unset __conda_setup
 # <<< conda initialize <<<

方法3:

先切回bash,然后输入命令conda init zsh 然后切回zsh

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值