脚本启动虚拟环境

一、需求:希望使用脚本启动虚拟环境下的jupyter notebook

二、问题:

  直接使用如下脚本(jupyternotebook.sh):

conda activate python
nohup jupyter notebook --no-browser --ip=0.0.0.0 --allow-root &

出错,提示如下信息:

“CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
...

三、处理办法:

经查询互联网,在https://blog.csdn.net/qq_30722795/article/details/107725045找到办法,即,添加一行命令“source activate”。

正确的脚本文件(jupyternotebook.sh)内容如下:

source activate
conda activate python
nohup jupyter notebook --no-browser --ip=0.0.0.0 --allow-root &

原文地址:https://www.cnblogs.com/sfccl/p/14510718.html