1.安装 runipy
pip install runipy
2.终端运行
runipy <YourNotebookName>.ipynb
在终端命令行执行shell脚本,(也可以在crontab 中执行):
(base) [recommend@app-0-5-B-006 script]$ cat run1.sh
#!/bin/bashcd /home/recommend/code/content_similarity/script__conda_setup="$('/home/recommend/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; theneval "$__conda_setup"
elseif [ -f "/home/recommend/anaconda3/etc/profile.d/conda.sh" ]; then. "/home/recommend/anaconda3/etc/profile.d/conda.sh"elseexport PATH="/home/recommend/anaconda3/bin:$PATH"fi
fi
unset __conda_setupconda init bash
conda activate py37
runipy my.ipynb