I'm looking for a way to put my startup script in Jupyter. In IPython, I put it under the $IPYTHON_DIR/profile_default/startup/
.
In Jupyter, it seems that the config file should be $JUPYTER_CONFIG_DIR/jupyter_notebook_config.py
. However, I would like to use my startup file, which import a slew of Python libraries at the launch of the kernel.
Where can I put such file in Jupyter?
To launch Jupyter Notebook App: Click on spotlight, type terminal to open a terminal window. Enter the startup folder by typing cd /some_folder_name . Type jupyter notebook to launch the Jupyter Notebook App The notebook interface will appear in a new browser window or tab.
Inside the Notebook. When you open a new Jupyter notebook, you'll notice that it contains a cell. Cells are how notebooks are structured and are the areas where you write your code. To run a piece of code, click on the cell to select it, then press SHIFT+ENTER or press the play button in the toolbar above.
You can get the default startup script folder via this in jupyter notebook:
get_ipython().profile_dir.startup_dir
On my Windows PC, the folder is: C:\Users\myusername\.ipython\profile_default\startup
And do read the README file under the folder.
Files will be run in lexicographical order, so you can control
the execution order of files with a prefix, e.g.::
00-first.py
50-middle.py
99-last.ipy
So you can put a file named 00-xx.py
under the folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With