Mac安装Jupyter
1. 安装Homebrew:
如果您还没有安装Homebrew,请访问官方网站(添加链接描述)获取安装命令。在Mac终端中粘贴并运行以下命令:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2.安装Python3:
brew install python
3.查看Python3
安装完成后,您可以通过运行python3 --version命令来检查Python版本,也可以通过以下代码查看python位置以及版本:
which python3 # 查看python安装路径
python3 -V # 查看python版本
4.配置环境变量:
jupyter-notebook的安装路径(一般也是python的安装路径)
- 创建.bash_profile文件,用于添加的环境变量
touch ~/.bash_profile
- 打开.bash_profile文件
open -e .bash_profile
- 添加环境变量,jupyter-notebook的安装路径(一般也是python的安装路径)
# python
export PATH="/usr/bin:$PATH"
export PATH="$PATH:/Users/liumingze/Library/Python/3.9/bin"
export PATH="/Users/liumingze/Library/Python/3.9/bin:$PATH"
5. 更新pip
安装Python后,pip3应该已经自动安装。建议您更新pip3到最新版本。在终端中输入以下命令:
pip3 install --upgrade pip
6. 安装Jupyter:
使用pip3安装Jupyter的命令如下:
pip3 install jupyter
7.安装并启动Jupyter Notebook:
安装完成后,您可以在终端中输入以下命令启动Jupyter Notebook:
pip3 install notebook # 安装Notebook
jupyter notebook # 打开Notebook
这将在您的默认浏览器中打开一个新的Jupyter Notebook窗口。如果浏览器没有自动打开,请查看终端输出的URL(通常是 http://localhost:8888/),然后在浏览器中手动输入该URL。
8.同理安装 JupyterLab|Voilà
1.安装并打开JupyterLab
pip3 install jupyterlab # 安装jupyterlab
jupyter-lab #打开jupyterlab
2.安装并打开Voilà
pip3 install voila # 安装voila
voila #打开voila
9.卸载 Jupyter
1.在终端上输入:
pip3 uninstall jupyter
系统会提示您确认卸载操作。输入y,然后按Enter键以确认卸载。
2.卸载Jupyter Notebook及其相关库
pip3 uninstall jupyter_core jupyter_client jupyter_console jupyterlab_widgets notebook qtconsole nbconvert nbformat ipykernel ipywidgets
现在,您已经使用Homebrew和pip3成功在Mac上安装并运行了Jupyter Notebook,JupyterLab,Voilà。