Create a .bat file to run a Python script or a key to start jupyter notebook, etc.

Sometimes, in order to run a Python script or start jupyter notebook in win 7 console, you need to enter several commands in a row, if you make a .bat file, then double-click the .bat entire operation can be completed.

 

such as:

The first step: activate an anaconda virtual environment.

Step 2: Run main.py program.

 

method:

Create a .bat file, enter in it:

call activate your_env_name
call python main.py

bat syntax to start the program there are two commands, call and start.

call similar to the internal call, which run in a terminal program call, start a command to create a new terminal calling program.

Reproduced in: https: //www.cnblogs.com/Edison25/p/11095531.html

Guess you like

Origin blog.csdn.net/weixin_34290390/article/details/94171981