激活虚拟环境并启动批处理文件中的jupyter Notebook

use*_*890 4 python windows cmd conda jupyter-notebook

我创建了以下批处理文件:jupyter_nn.bat。内部文件我有:

cd "C:\My_favorite_path"
activate neuralnets
jupyter notebook
Run Code Online (Sandbox Code Playgroud)

因此,目标是激活conda虚拟环境并启动jupyter Notebook。由于某些原因,这不起作用。窗户立即关闭。如果我从cmd运行此批处理文件,则仅执行activate neulranets。我已经尝试过pausepause>nul其他伏都教舞蹈。有什么建议么?这也适用于Windows 7。

dar*_*ith 6

您需要CALL在激活之前添加。由于activate是另一个批处理脚本,除非您使用CALL它,否则整个过程将退出。请参阅此处以获取更多说明:如何在一个.BAT文件中运行多个.BAT文件

cd "C:\My_favorite_path"
CALL activate neuralnets
jupyter notebook
Run Code Online (Sandbox Code Playgroud)

(您可能还需要CALLJupyter Notebook)