0
votes

The default directory of Jupyter notebook is the C:\Users\User Name\ I want to open several Jupyter notebooks in different folders at the same time (some of them in portable drives). additionally, I want to run Jupyter under specific Anaconda environment, with specific libraries and version of python.

I tried until I found the easiest and fastest solution for Windows which I will post in the answers below for the benefit of others.

I have provided the solution for windows, so I hope that others can add similar solutions for Mac and Linux.

Thanks

2

2 Answers

0
votes

The easiest solution is to make a batch file (*.bat) with the following commands:

REM # A batch file to run Jupyter notebook  on the current folder 

REM # This is to switch to the current directory
setlocal
cd /d %~dp0

REM # If you need special Anaconda environment, replace the py3 name.
REM # If you want to run on the default environment, remove the line.
call activate py3

REM # It is important to add the 'call' 
call jupyter notebook

REM # The pause command is to keep the command window active.
pause

If you do not want to run a special Anaconda environment, remove the line call activate py3. and if you want to activate different environment, replace the py3 by its name.

Finally, you have to save the commands above to a text file, rename it to LaunchJupyterHere.bat or any name of your choice, and place a copy of it in each folder you want to launch Jupyter in. once you want to launch Jupyter, double-click it, it will open a browser window pointing to the current directory, and under the specific environment.

Best regards

0
votes

That may be the easiest windows solution; for me I use Anaconda; (1) activate the environment. (2) Open a terminal in that environment via enter image description here Then assuming I want the root to be my E: drive; just->

E:
jupyter notebook