【问题标题】:Activate virtual environement and start jupyter notebook all in batch file激活虚拟环境并在批处理文件中启动 jupyter notebook
【发布时间】:2017-07-10 05:40:59
【问题描述】:

我创建了以下批处理文件:jupyter_nn.bat。 我有里面的文件:

cd "C:\My_favorite_path"
activate neuralnets
jupyter notebook

所以目标是激活 conda 虚拟环境并启动 jupyter notebook。由于某种原因,这不起作用。窗口立即关闭。如果我从 cmd 运行这个批处理文件,它只会执行activate neulranets。我已经尝试过pausepause>nul 以及其他巫毒舞蹈。有什么建议?这也适用于 Windows 7。

【问题讨论】:

    标签: python windows cmd jupyter-notebook conda


    【解决方案1】:

    您需要在激活前添加CALL。由于activate是另一个批处理脚本,除非你CALL它,整个过程都会退出。更多解释请看这里:How to run multiple .BAT files within a .BAT file

    cd "C:\My_favorite_path"
    CALL activate neuralnets
    jupyter notebook
    

    (您可能还需要CALL Jupyter Notebook)

    【讨论】:

    • 非常感谢!无需CALL Jupyter Notebook。
    猜你喜欢
    • 2019-09-25
    • 1970-01-01
    • 1970-01-01
    • 2022-10-17
    • 2020-05-08
    • 2018-04-06
    • 1970-01-01
    • 1970-01-01
    • 2021-01-22
    相关资源
    最近更新 更多