Python Jupyter notebook Various methods of use recording • Continuous update __python

Source: Internet
Author: User
Tags documentation jupyter jupyter notebook
Pythonjupyter notebook A variety of use method records continuously update a jupyter notebook installation 1 new version Anaconda with Jupyter 2 old version Anacodna need to install Jupyter two change jupyter not Ebook Workspace 1 Mode 12 way two ace trick three jupyter a variety of shortcut keys four Jupyter notebook how to import code 1 to load a local py file into a cell in Jupyter 2 from Network Load code to jupyter five Jupy ter run Python file six jupyter some other trivial usage 1 jupyter cell can be used as UNIX command using 2 Magic functions 3 Get current working directory 4 use Matplo Markdown 1 in Tlib drawing seven Jupyter set link in Jupyter set two part 2 add directory functionality to Jupyter notebook

Jupyter notebook) Formerly known as Ipython Notebook, when learning, you can find both tutorials jupyter Project documentation jupyter Notebook documentation The jupyter/ IPython Notebook Quick Start Guide old IPython Notebook homepage One, Jupyter notebook installation 1.1 new version Anaconda self-belt Ju Pyter Currently, the latest version of the Anaconda is brought Jupyter notebook, do not need to be installed separately
1.2 old version Anacodna need to install Jupyter

Jupyter Notebook installation of the official website

Prerequisites for installing Jupyter notebook: Python (python 2.7 or python3.3) is already installed

Specific installation methods: The official proposal to use Anaconda installation Jupyter installation completed Anaconda, if the Anaconda does not bring Jupyter Noterbook, then, open cmd, enter: Conda install Jupyter

This installed jupyter does not have the new a terminal function
After a variety of queries, it turns out that Windows does not have the terminal required TTY, so jupyter in Windows does not support terminal mode, and there is no plan to increase this support in the short term

Ii. Changing the working space of the Jupyter notebook 2.1 Mode One

"Not every time."

In its configuration file ipython_notebook_config.py, like the next sentence

# The directory to use for notebooks and kernels.
# c.notebookapp.notebook_dir = U '
1 2 3

This sentence is used to specify its workspace, for example, the default workspace is: User name folder, for example, now want to change the workspace to D:\Jupyter, then you need to make the following changes (remember to delete Note #)

# The directory to use for notebooks and kernels.
C.notebookapp.notebook_dir = U ' D:\Jupyter '
1 2 3

Note: Do not add the symbol "\" After the last level of the path

How to find the configuration file. Enter Jupyter notebook in cmd--generate-config if the configuration file already exists, the following information appears, where you can see where the configuration file exists, note that at this point, enter n and do not overwrite
If the profile does not exist, it will initialize the resulting configuration file

Enter in cmd: Ipython profile Create
Find out about the location of the Jupyter profile 2.2 way two trick (ACE) into the Working directory folder

Keyboard shift+ the right mouse button-> Open the command window here-> enter in the pop-up command window: Jupyter Notebook

Jupyter is opened to navigate to the current directory.
Three, Jupyter a variety of shortcut keys

Executes the current cell and automatically jumps to the next Cell:shift Enter

Executes the current cell and does not automatically switch to the next cell:ctrl-enter after execution

is the current cell into edit mode: Enter

Exit edit mode for the current cell: ESC

Delete the current cell: double D

Add line number to the current cell: single L

Converts the current cell into a maskdown with a first-level title: Single 1

Converts the current cell into a maskdown with a level two title: Single 2

Converts the current cell into a maskdown with a level three title: Single 3

Add/Remove comments for one or more lines: CRTL/

Undo deletion of a cell: Z

Switch between the tabs of the browser: Crtl PgUp and Crtl PgDn

Quick jump to the first CELL:CRTL home

Quick jump to the last Cell:crtl end Four, Jupyter notebook how to import code

That is, the import code into the cell in Jupyter notebook 4.1 to load the Local. py file into a cell in Jupyter

Problem background: There is a test.py file that needs to be loaded into a cell in Jupyter
test.py contents are as follows:

Import Caffe
solvername = "/root/workspace"
Sovler = Caffe. Adamsolver (Solvername)
1 2 3

Method steps:
(1) Enter the cell in which you want to import the code

%load test.py #test. py is a python file under the current path
1

(2) Running the cell
Using the shortcut key "Shift+enter", you can see the following results:

(3) You can see that after the run,%load test.py was automatically added to the annotation symbol #,test.py all the code in the current cell was load to 4.2 from the Network load code to Jupyter

Enter%load http://... in the cell, and then run the cell to load the corresponding address on the following load into the current cell;

Here is an example of importing a small example in Matplotlib color example code

First, in the cell where you want to import the code, enter

%load test.py #test. py is a python file under the current path
1

Then, Shift+enter runs, you can see the following results:

As you can see, after the run,%load test.py is automatically added to the annotation symbol #,test.py all the code in the current cell is load to five, jupyter run the python file Using the Jupyter cell, you can run the Python file by running the following code in the cell:

%
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.