每次重新运行终端时,我都必须输入 export PATH=~/anaconda/bin:"$PATH"
I have to type export PATH=~/anaconda/bin:"$PATH" everytime I rerun the terminal
我已经为 Mac 安装了 Anaconda,但是我有一些问题:
当我键入命令which conda
或 which ipython
时,我得到 conda not found
和 ipython not find
然后我发现这个命令 export PATH=~/anaconda/bin:"$PATH"
对我有用。它解决了上面的问题,但是每次我重新运行终端,问题仍然存在,我必须重新输入。
所以我想想办法从根本上解决问题
我尝试将它添加到 ~/.bashrc
、~/.profile
、~/.bash_profile
,但这些对我不起作用。
在 .bash_profile
试试这个
export PATH="$HOME/anaconda/bin:$PATH"
然后尝试启动一个新的终端和运行:
echo $PATH
输出应以 /anaconda/bin:
开头
如果仍然无效...解决方法可能是在 运行 终端后调用 bash,即键入“bash”。这应该会导致 bash 以 .bash_profile
启动
sudo xed /etc/environment
打开此存档后添加:/home/youruser/anaconda3/bin
确保您没有使用 ZSh 或其他形式的 shell。如果是这种情况,您必须将路径添加到各自的 shell 文件,例如 .zshrc
.
我 运行 在 MacOs Catalina 10.15 上,这对我有用:
shell 是 zsh !
$ source /Users/myprofilename/anaconda3/bin/activate
然后
$ conda init zsh
新的 anaconda 文档也 highlights this:
如果您使用的是 ZShell,请按照以下步骤操作:
- 在你的终端输入 open ~/.zshrc
- 将以下内容添加到文件 export PATH=/opt/homebrew/bin:$PATH
- 保存你的文件然后运行下面的命令source ~/.zshrc
请注意,Apple silicon 上的自制程序路径是 /opt/homebrew/bin
我已经为 Mac 安装了 Anaconda,但是我有一些问题:
当我键入命令which conda
或 which ipython
时,我得到 conda not found
和 ipython not find
然后我发现这个命令 export PATH=~/anaconda/bin:"$PATH"
对我有用。它解决了上面的问题,但是每次我重新运行终端,问题仍然存在,我必须重新输入。
所以我想想办法从根本上解决问题
我尝试将它添加到 ~/.bashrc
、~/.profile
、~/.bash_profile
,但这些对我不起作用。
在 .bash_profile
试试这个export PATH="$HOME/anaconda/bin:$PATH"
然后尝试启动一个新的终端和运行:
echo $PATH
输出应以 /anaconda/bin:
开头如果仍然无效...解决方法可能是在 运行 终端后调用 bash,即键入“bash”。这应该会导致 bash 以 .bash_profile
启动sudo xed /etc/environment
打开此存档后添加:/home/youruser/anaconda3/bin
确保您没有使用 ZSh 或其他形式的 shell。如果是这种情况,您必须将路径添加到各自的 shell 文件,例如 .zshrc
.
我 运行 在 MacOs Catalina 10.15 上,这对我有用: shell 是 zsh !
$ source /Users/myprofilename/anaconda3/bin/activate
然后
$ conda init zsh
新的 anaconda 文档也 highlights this:
如果您使用的是 ZShell,请按照以下步骤操作:
- 在你的终端输入 open ~/.zshrc
- 将以下内容添加到文件 export PATH=/opt/homebrew/bin:$PATH
- 保存你的文件然后运行下面的命令source ~/.zshrc
请注意,Apple silicon 上的自制程序路径是 /opt/homebrew/bin