当前位置:   article > 正文

【MAC】 用自带的 python3 安装 jupyter_mac python3 jupyter

mac python3 jupyter

【MAC】用自带的python3安装jupyter

首先是有一个误区

//直接使用下面的指令是不可以的
pip3 install jupyter
  • 1
  • 2

会出现这样的问题
在这里插入图片描述
虽然也是正常安装了,但是如果直接使用jupyter指令,是无法使用的。
在这里插入图片描述

按照下面的方法进行jupyter 的安装

  1. 查看已安装的python
which python3
  • 1
  1. 安装jupyter
    安装jupyter,可以安在系统,也可以安在使用者的个人资料夹,最好是安在后者也就是使用者的个人资料夹的位置。
python3 -m pip install jupyter --user
  • 1

安装过程会出现这样的warning

WARNING: The scripts jupyter, jupyter-migrate and jupyter-troubleshoot are installed in '/Users/yangxinyu/Library/Python/3.9/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.
  • 1
  • 2

这个的意思是「你所安装的jupyter没有放在预设路径($PATH)內,而是放在/Users/yangxinyu/Library/Python/3.9/bin」。举个例子,预设路径里面有python3,所以我们只需要在terminal輸入python3就可以执行,不需要打上完整的/usr/bin/python3。因为预设路径的緣故,所以执行Jupyter Notebook,要这样做:

/Users/yangxinyu/Library/Python/3.9/bin/jupyter notebook
  • 1
  1. 这样会比较麻烦,所以我们还是设置一下
# For zsh user
echo export PATH="/Users/yangxinyu/Library/Python/3.9/bin:${PATH}" >> ~/.zshrc
source ~/.zshrc

# For bash user
echo export PATH="/Users/yangxinyu/Library/Python/3.9/bin:${PATH}" >> ~/.bashrc
source ~/.bashrc
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  1. 确认预设路径是否成功
which jupyter
  • 1
  1. 使用jupyter
jupyter notebook
  • 1

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/297713
推荐阅读
相关标签
  

闽ICP备14008679号