情况描述:Mac安装anaconda后,运行
terminal
后显示zsh: command not found:
,后缀包括conda
,pip
等
1. 原因解释
缺少告诉系统python
的路径位置的脚本
2. 解决方式
2.1.在Terminal中用vim命令打开文件
open ~/.zshrc
当然,也可以使用
vi ~/.zshrc
或者
nano ~/.zshrc
vi
的操作对于新手而言相对困难些,需要记忆一些键盘快捷键进行操作;
open
命令的操作,类似于打开一个文本文档,直接进行交互操作;
nano
命令可以实现Command + C
的复制粘贴操作,但对于保存Ctrl + O
和退出'Ctrl + X'需要记住
2.2 添加path路径
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/lin/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
并在最后添加
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# added by Anaconda3 5.2.0 installer
export PATH="/Users/lin/anaconda3/bin:$PATH"
主要是export PATH="/Users/lin/anaconda3/bin:$PATH"
这行命令。
2.3 重启
在 Terminal
中进行一下命令
source ~/.zshrc
3. .bash_profile
脚本添加路径

运行命令:
open ~/.bash_profile
打开后内容为
# added by Anaconda3 5.2.0 installer
export PATH="/Users/lin/anaconda3/bin:$PATH"
网友评论