Jupyter Notebook plugins and other little tricks

install plugin

1.pip direct installation

pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user

2. If method 1 is unsuccessful, use anoconda installation
insert image description here
to open Anaconda Prompt and enter the installation command

conda install -c conda-forge jupyter_nbextensions_configurator
conda install -c conda-forge jupyter_contrib_nbextensions

After the installation is successful, open jupyter, and a plug-in window will appear on the page.
insert image description here
insert image description here
If conda has been installed but failed, uninstall and reinstall:

conda remove jupyter_nbextensions_configurator
conda install -c conda-forge jupyter_nbextensions_configurator
conda install -c conda-forge jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
jupyter nbextensions_configurator enable --user

code auto-completion

Hinterland Code Completion: Automatically complete code.
insert image description here

variable view highlighting

Select Nbextensions and check Highlight selected word.
insert image description here

code folding

Codefolding in Editor: Add the function of folding code,
insert image description here
insert image description here
and you can also fold by title: Collapsible headings

show line number

Menu bar View------Toggle Line Numbers
insert image description here
can also use plug-ins: Toggle all line numbers to display code line numbers.

execution time

Execute time displays the execution time

insert image description here

multiline print

from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"

insert image description here

Canonical code

PEP8 specification code optimization: Code prettify
follows the PEP8 Python coding specification: link: "PEP 8 – Style Guide for Python Code" beautifies the code, relying on the YAPF module developed by Google.
insert image description here
insert image description here

Module quick access

Quick access to Document:
Quickly add python, examples of common modules, documents, etc. in the Snippets menu.
insert image description here

Install the package in jupyter notebook

To install the package in jupyter notebook, add "!" in front of the installation command.

! pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pygtrans

hot key

insert image description here
Reference link: https://zhuanlan.zhihu.com/p/346703253

Guess you like

Origin blog.csdn.net/qq_47326711/article/details/131155581