1.本文假设读者已经安装python3以及pip3(安装python3后会自带)
2.安装指令
$ pip3 install --user jupyter
在等待过程中会出现很多看起来不太舒服的提示(看文字颜色就觉得异常),异常提示如下
The scripts jupyter, jupyter-migrate and jupyter-troubleshoot are installed in '/Users/chenhao/Library/Python/3.6/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The scripts jupyter-kernel, jupyter-kernelspec and jupyter-run are installed in '/Users/chenhao/Library/Python/3.6/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The script jsonschema is installed in '/Users/chenhao/Library/Python/3.6/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The script jupyter-trust is installed in '/Users/chenhao/Library/Python/3.6/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The script pygmentize is installed in '/Users/chenhao/Library/Python/3.6/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The script jupyter-nbconvert is installed in '/Users/chenhao/Library/Python/3.6/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The scripts iptest, iptest3, ipython and ipython3 are installed in '/Users/chenhao/Library/Python/3.6/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The scripts jupyter-bundlerextension, jupyter-nbextension, jupyter-notebook and jupyter-serverextension are installed in '/Users/chenhao/Library/Python/3.6/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The script jupyter-console is installed in '/Users/chenhao/Library/Python/3.6/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
3.等待结束之后,我们测试一下,看能不能用
$ jupyter notebook --help
结果提示,果然不能用
-bash: jupyter: command not found
出现这个原因是因为环境变量未配置,所以我们配置一下环境变量
3.我们进入环境变量的配置文件
$ vim ~/.bash_profile
然后在文件里添加以下配置
export PATH=/Users/chenhao/Library/Python/3.6/bin:$PATH
这里注意替换成你的jupyter的安装目录,也就是本文的第二个代码框里显示的路径(每个人不一样),然后保存退出。
4.接下来使配置文件生效,并且再次测试一下
$ source ~/.bash_profile #使配置文件生效
$ jupyter notebook --help #测试,有一大堆东西跳出来说明成功了
网友评论