Mac Studio配置Jupyter
MAC开荒
最新安装的Anaconda已自动安装Jupyter Lab和 Jupyter Notebook,需要额外设置远程访问,
-
SHELL输入
jupyter notebook --generate-config
生成配置文件; -
SHELL进入Python,
from notebook.auth import passwd
passwd
; -
修改文件
./jupyter/jupyter_notebook_config.py
,配置c.NotebookApp.ip='*'
' c.ServerApp.password = u'argon2xxxxxxxxxx'
,配置c.ServerApp.port
为8888,配置c.ServerApp.open_browser = False
。
Jupyter设置虚拟环境切换,
-
安装ipykernel,分别在base和虚拟环境;
-
切换到虚拟环境
conda activate env
,手动添加kernel到Jupyterpython -m ipykernel install --user --name HarvardU --display-name "HarvardU"
; -
重启Kernel生效。
Jupyter更改默认工作目录,修改文件./jupyter/jupyter_notebook_config.py
,修改c.ServerApp.notebook_dir
为工作目录。
Jupyter设置静默后台运行,SHELL输入nohup jupyter lab > /dev/null 2>&1 &
,意为将日志输出到/dev/null
文件,此文件为空,即不输出日志信息,2为标准错误输出,1为标准输出。
关闭Jupyter后台运行,可利用ps -ef | grep jupyter
查找jupyter相关进程,利用kill -9 pid
关闭进程。如未曾关闭SHELL,ps -a即可查看进程pid。
参考链接:
https://service.oray.com/question/14465.html
https://blog.csdn.net/LoseInVain/article/details/101875110
https://zhuanlan.zhihu.com/p/50456606
https://www.cnblogs.com/jasondan/p/3499175.html
https://morooi.com/2019/jupyter/