环境
机型:Apple M1 Pro
python: 3.10
jupyter安装
pip install jupyterlab
pip install notebook
jupyter notebook
问题
运行jupyter notebook时报错zsh: command not found: jupyter
解决方案
打开.zshrc,添加jupyter的环境,路径查看可以使用pip show jupyter,你可能看到输出如下:
Name: jupyter
Version: 1.0.0
Summary: Jupyter metapackage. Install all the Jupyter components in one go.
Home-page: http://jupyter.org
Author: Jupyter Development Team
Author-email: jupyter@googlegroups.org
License: BSD
Location: /Users/xxx/.local/lib/python3.10/site-packages
Requires: ipykernel, ipywidgets, jupyter-console, nbconvert, notebook, qtconsole
Required-by:
其中Location就是jupyter的安装路径,jupyter的命令脚本在和lib同级目录的bin目录。
vim .zshrc
在最后一行追加
export PATH=/Users/xxx/.local/bin:$PATH
使配置生效
source .zshrc
重新打开终端执行jupyter notebook,jupyter就可以打开了,搞定收工。