Activate virtual environement and start jupyter notebook all in batch file

2024/9/30 7:16:26

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.

Answer

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://en.xdnf.cn/q/71115.html

Related Q&A

several contour plots in the same figures

I have several 3d functions. I would like two plot the contour plots of them in the same figure to see the difference between them. I expect to see some crossings between contours of two functions. Her…

how to detect all the rectangular boxes in the given image

I tried to detect all the rectangles in image using threshold, canny edge and applied contour detection but it was not able to detect all the rectangles. Finally, I thought of detect the same using hou…

Python Pandas Series failure datetime

I think that this has to be a failure of pandas, having a pandas Series (v.18.1 and 19 too), if I assign a date to the Series, the first time it is added as int (error), the second time it is added as …

Remove a dictionary key that has a certain value [duplicate]

This question already has answers here:Removing entries from a dictionary based on values(4 answers)Closed 10 years ago.I know dictionarys are not meant to be used this way, so there is no built in fun…

Get names of positional arguments from functions signature

Using Python 3.x, Im trying to get the name of all positional arguments from some function i.e: def foo(a, b, c=1):returnRight now Im doing this: from inspect import signature, _empty args =[x for x, p…

Emacs Python-mode syntax highlighting

I have GNU Emacs 23 (package emacs23) installed on an Ubuntu 10.04 desktop machine and package emacs23-nox installed on an Ubuntu 10.04 headless server (no X installed). Both installations have the sam…

programmatically edit tab order in pyqt4 python

I have a multiple textfield in my form. My problem is the tab order is wrong. Is there a way to edit tab order in code? Just like in QT Designer.thanks.

Getting the parent of a parent widget in Python Tkinter

I am trying to get the parent of a widget then get the parent of that widget. But Everytime I try to I get a error.Error:AttributeError: str object has no attribute _nametowidgetWhy is it giving me tha…

Python Random List Comprehension

I have a list similar to:[1 2 1 4 5 2 3 2 4 5 3 1 4 2] I want to create a list of x random elements from this list where none of the chosen elements are the same. The difficult part is that I would lik…

How to handle unseen categorical values in test data set using python?

Suppose I have location feature. In train data set its unique values are NewYork, Chicago. But in test set it has NewYork, Chicago, London. So while creating one hot encoding how to ignore London? In…