我无法运行anaconda并在终端机中进行错误提示

时间:2019-02-03 12:13:50

标签: bash terminal anaconda command-line-interface conda

我在macOS中安装了anaconda,然后尝试在终端中运行conda命令,但出现了以下错误消息:

****/Users/rodalbert/.anaconda/navigator/a.tool ; exit;
/Users/rodalbert/.bash_profile:export:3: not an identifier: 2018.12
➜  ~ /Users/rodalbert/.anaconda/navigator/a.tool ; exit;
/Users/rodalbert/.anaconda/navigator/a.tool: line 1: syntax error near unexpected token `('
/Users/rodalbert/.anaconda/navigator/a.tool: line 1: `bash --init-file <(echo "source activate /Users/rodalbert/anaconda3;")'
[Process completed]****

我试图找出问题出在哪里,但我找不到它!

有人知道在这种情况下该怎么做

.bash_profile的内容

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH=/Applications/Postgres.app/Contents/Versions/11/bin/psql:$PATH# added by Anaconda3 2018.12 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<
# added by Anaconda3 2018.12 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/rodalbert/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/Users/rodalbert/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/rodalbert/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/Users/rodalbert/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

2 个答案:

答案 0 :(得分:4)

似乎您正在使用Zsh。

在Anaconda Navigator中执行任何命令之前,请尝试打开终端应用程序并将Shell切换为bash:chsh -s /bin/bash,然后重新启动终端。

使用Anaconda完成操作后,切换回Zsh:chsh -s /bin/zsh,然后重新启动终端。

答案 1 :(得分:0)

我使用了MohammadChavos的解决方案,因此conda可以在终端上运行。

cd /path/to/anaconda/bin
./conda init zsh
or:
zsh conda init zsh

我的情况:cd opt / anaconda3 / bin,然后运行:./conda init zsh