MacBook使用pip安装JupyterLab

1、pip install jupyterlab或者pip3 install jupyterlab
2、安装完毕后,输入jupyter-lab,但是报错了!

-bash: jupyter-lab: command not found

别慌,先找安装的文件在哪儿!使用下面的语句查找安装的地方

mdfind -name jupyter

我的结果为(删除部分,保留/bin部分,因为这里存的是命令)

/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-console
/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-qtconsole
/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-serverextension
/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-notebook
/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-nbextension
/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-bundlerextension
/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-nbconvert
/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-trust
/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-run
/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-kernelspec
/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-kernel
/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-troubleshoot
/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter-migrate
/Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter

可以看到上面的结果,文件路径在/Library/Frameworks/Python.framework/Versions/3.7/bin里面,于是打开上诉文件件,找到jupyter-lab,双击运行,会发现,哎,出来了。
MacBook使用pip安装JupyterLab_第1张图片
MacBook使用pip安装JupyterLab_第2张图片
3、可以看出找不到命令还需要配置环境变量,于是vi ~/.bash_profile

1、JUPYTER=/Library/Frameworks/Python.framework/Versions/3.7
2、PATH=原来的路径:$JUPYTER/bin
3、export JUPYTER
4、export PATH

最后,source ./.bash_profile,使刚才的文件生效,echo $PATH查看是否有新添加进去的路径。
4、jupyter-lab,就ok啦!

你可能感兴趣的:(python)