Reputation: 287
I currently open Jupyter Notebook by running jupyter notebook
in my terminal.
I have 2 questions that relate to a common goal.
1) How do I create a desktop icon (i.e. launcher) to start Jupyter Notebook on my Linux Mint computer?
2) I want to run some basic code upon double-clicking this launcher:
import numpy as np
import pandas as pd
import seaborn as sb
import sklearn as skl
I don't want to type this code whenever I open Jupyter Notebook, so it would be nice to automatically run it.
For #1, I'm trying to follow the steps here:
https://forums.linuxmint.com/viewtopic.php?t=256156#p1382045
However, I don't know where to find the path for the "Command" field. I tried browsing the Anaconda folder on my computer, but I can't find Jupyter Notebook there.
Upvotes: 1
Views: 1923
Reputation: 2604
For your first question, if you open up a terminal, you can find where programs are with which
, like so
which jupyter
This should output where your particular jupyter
is being called from.
For your second question, it looks like you can create a profile to start up certain functions.
In bash, you can run the following
# Create a new folder if it already doesn't exist
mkdir -p ~/.ipython/profile_default/startup
# Create Python file to put your favorite imports
touch ~/.ipython/profile_default/startup/start.py
So the start.py
(that is located in ~/.ipython/profile_default/startup/
) is where you can put your imports. So this start.py
file should contain
import numpy as np
import pandas as pd
import seaborn as sb
import sklearn as skl
Resources:
In sum, if you implement both of the suggestions above, you can get both an icon to auto-load your favorite Python library packages as you start a Jupyter Notebook.
Warning: typically for reproducibility and transferability of Jupyter Notebooks to others, I would go against auto-loading libraries into your Jupyter Notebook. I understand the repetition of having to load the same libraries you use all the time, but if for whatever reason, you change computers or a colleague needs your code, then your notebook will not work correctly. Just my two cents to keep in mind if/when implementing this.
Upvotes: 2