Activate virtual environement and start jupyter notebook all in batch file

拟墨画扇 提交于 2019-12-07 11:19:38

问题


I created the following batch file: jupyter_nn.bat. Inside file I have:

cd "C:\My_favorite_path"
activate neuralnets
jupyter notebook

So the goal is to activate conda virtual environment and start jupyter notebook. For some reason this does not work. Window immediately shuts down. If I run this batch file from cmd, it only executes activate neulranets. I already tried pause and pause>nul and other voodoo dances. Any suggestions? Also this is for Windows 7.


回答1:


You need to add CALL before the activate. Since activate is another batch script, unless you CALL it, the whole process will exit. See here for more explanation: How to run multiple .BAT files within a .BAT file

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

(You might also need to CALL the Jupyter Notebook)



来源:https://stackoverflow.com/questions/42353108/activate-virtual-environement-and-start-jupyter-notebook-all-in-batch-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!