激活虚拟环境并启动批处理文件中的jupyter笔记本 [英] Activate virtual environement and start jupyter notebook all in batch file

查看:455
本文介绍了激活虚拟环境并启动批处理文件中的jupyter笔记本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

cd "C:\My_favorite_path"
activate neuralnets
jupyter notebook

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

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.

推荐答案

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

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

(您可能还需要CALL Jupyter Notebook)

(You might also need to CALL the Jupyter Notebook)

这篇关于激活虚拟环境并启动批处理文件中的jupyter笔记本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆