通过pip安装Jupyter后,使用终端打开Jupyter notebook提示Command not found。没有配置环境变量。
处理:
1.查找Jupyter安装地址,终端输入:mdfind -name jupyter
2.复制安装地址,例:/Users/admni/Library/Python/3.9/bin/jupyter
3.添加临时变量,终端输入:export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin
4.打开zsh配置文件:open -e .zshrc
5.文件新一行输入:source ~/.bash_profile
6.文件保存退出,刷新状态,终端输入:source .zshrc
7.编辑bash_profile文件,终端输入:open .bash_profile
8.如果提示文件不存在:.bash_profile does not exist.
8.1.打开创建隐藏文件权限,终端输入:defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder
8.2.跳转目录,终端输入:cd ~/
8.3创建文件,终端输入:touch ~/.bash_profile
8.4.回到7.
9.添加地址,文件内输入:export PATH=安装目录+:$PATH
9.1例:export PATH=/Users/admni/Library/Python/3.9/bin/:$PATH
10.文件保存退出,刷新状态,终端输入:source ~/.bash_profile
11.测试生效:终端输入:which jupyter
12.打印地址。