簡體   English   中英

無法在 MacOS 終端中運行 Anaconda

[英]Can't run Anaconda in MacOS terminal

我在 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 <<<

看起來您正在使用 Zsh。

在 Anaconda Navigator 中執行任何命令之前,請嘗試打開您的終端應用程序並將 shell 切換到 bash: chsh -s /bin/bash然后重新啟動終端。

完成 Anaconda 后,切換回 Zsh: chsh -s /bin/zsh然后重新啟動終端。

我使用了MohammadChavos的解決方案,然后 conda 可以在終端上運行。

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM