1 Jupyter profile

Jupyter Notebook is an interactive Notebook that runs more than 40 programming languages. Essentially, it is a Web application that facilitates the creation and sharing of literary program documents, supports real-time code, mathematical equations, visualization and Markdown.

2 the installation

Install with PIP or PIP3:

# sudo pip install jupyter
sudo pip3 install jupyter
Copy the code

3 Simple custom Settings

First generate the default configuration:

jupyter notebook --generate-config
Copy the code

The default configuration location is then prompted. Open and findc.NotebookApp.notebook.dir=''You can modify the default directory:Note that you need to adduA prefix that represents a Unicode string.

c.NotebookApp.browserYou can change the default browser, for example, to Chrome:Need to add%sParameter, the path is changed to the corresponding path.

Modify other configurations according to comments.

4 the completion

Nbextensions and NbexTenSIONS_configurator are required for completion:

sudo pip3 install jupyter_contrib_nbextensions jupyter_nbextensions_configurator
# sudo pip install jupyter_contrib_nbextensions jupyter_nbextensions_configurator
jupyter contrib nbextension install --user
jupyter nbextensions_configurator enable --user
Copy the code

If the dependency is missing, please install the corresponding dependency, and open Jupyter after successful installation:

jupyter notebook
Copy the code

Go to the Nbextensions TAB, uncheck disable XXX, and select Hinterland:

5 beautification

The default UI is really ugly, there is a Jupyter-Themes tool on Github that can beauify it. Install first with PIp3 / PIP:

sudo pip3 install jupyterthemes
Copy the code

5.1 the theme

After installation is complete, use

jt -l
Copy the code

To view the themes, you can carry 7 themes:

  • onedork
  • grade3
  • oceans16
  • chesterish
  • monokai
  • solarizedl
  • solarizedd

Use -t to switch themes, for example:

jt -t chesterish
Copy the code

5.2 the font

Supports the following three customized fonts:

  • Code font:-f
  • Notebook font (interface font) :-nf
  • Plain text /Markdown fonts:-tf

The code font (-f) supports the following:

The Notebook fonts (-NF), ordinary text fonts (-tf), and Markdown fonts (-TF) are supported as follows:

Supports the following six custom font sizes:

  • Code font size:-fs11, the default
  • Notebook font size:-nfs, the default 13
  • Plain text /Markdown font size:-tfs, the default 13
  • Pandas Dataframs size:-dfs9, the default
  • Output area font size:-ofsThe default is 8.5,
  • Mathjax Font size:-mathfsPercentage, 100% by default

For example, if the author likes Firacode font and needs to enlarge the font in the output area, you can set it as follows:

jt -t chesterish -f firacode -fs 14 -ofs 12
Copy the code

5.3 Cell Width and Row Space

You can manually control the width of the Cell and the line spacing of the code, with -cellw controlling the width (default 980) and -lineh controlling the line spacing (default 170).

jt -cellw 1800 -lineh 200
Copy the code

5.4 UI Element Display

  • Toolbar hidden:-T
  • Implicit name and Logo:-N
  • Hidden kernel Logo:-kl

5.5 Drawing Style

Set with the following statement (needed in Jupyter) :

from jupyterthemes import jtplot
jtplot.style()
Copy the code

The style() parameter is as follows:

  • theme: String type, subject, optional value andjt -lShow consistent
  • context: The value is a stringpaper.notebook.talk.poster
  • grid: Boolean type indicating whether grid lines are included or not
  • gridlines: a string representing the gridline style, for example--Said the dotted line
  • ticks: Boolean type, indicating the explicit and implicit of coordinate lines on the X /y axis
  • spines: Boolean indicating whether a bounding box is displayed around the image
  • fscale:floatType, representing zoomed fonts, legends, and so on
  • figsize: Tuple type, representing the size of the default Matplotlib image

The author’s reference configuration:

jt -t chesterish -f firacode -fs 14 -ofs 12 -cellw 1500 -lineh 200 -T
Copy the code

6 Common library installation

With PIP + offline installation, you first need to know the system architecture. You can use:

arch
uname -m
Copy the code

For example, the author is x86_64, click here to enter the download, the common library list is as follows:

  • Numpy
  • Scipy
  • Scikit-learn
  • Scikit-image
  • Spark MLLib (called PySpark)
  • Theano
  • TensorFlow
  • PyTorch
  • Pandas
  • Matplotlib

To demonstrate the installation using numpy, search and click on the first one:

Select the package based on the Python version, system, and architecture. Download:usepip3orpipInstallation can be:Other libraries are installed similarly. If dependencies are missing, install them first.