Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
307 views
in Technique[技术] by (71.8m points)

Default template for iPython notebook (using Jupyter)

In the first cell of every iPython (Jupyter) notebook, I almost always type:

%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np

Is there a way to make it so that this cell appears at the top of each new notebook I create by default?

For example, could I save a template .ipynb file somewhere, which is copied by iPython when creating a new notebook?

(I found this question, but it seems to be more about css than default content in cells.)

question from:https://stackoverflow.com/questions/34002326/default-template-for-ipython-notebook-using-jupyter

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There is a pretty cool solution using jupyterlab: jupyterlab_templates

Installation took about 5 minutes and you can have as many

templates as you'd like.

Mac Users

Assuming you have conda installed than during the installation, you'll need to install node js engine:

  • conda install -c conda-forge nodejs

And create a jupter_noteook_config.py if you don't have one :

  • jupyter notebook --generate-config

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...