Learning programming tool --Jupyter Notebook

Jupyter Notebook Introduction

Jupyter Notebook is based on an application for interactive computing web page. It can be applied to the whole process of computing: developing, documenting, run the code and display the results. - Jupyter official presentation Notebook
 
Jupyter Notebook (formerly known IPython notebook) is an interactive notebook, run support more than 40 programming languages.

Nature Jupyter Notebook is a Web application, easy to create and share literary program documentation, support real-time code, mathematical equations, visualization and Markdown . Uses include: cleaning and conversion data, numerical simulation, statistical modeling, machine learning, etc. [1] . (Baidu Encyclopedia)
In short, Jupyter Notebook in the form of web pages to direct write and run code, you can also run the results in a web page. Also can write notes or comments, supports Markdown syntax.

Features:

  1. Jupyter supports over 40 programming languages, including Python, R, Julia and Scala.
  2. You can use e-mail, Dropbox, GitHub and Jupyter Notebook Viewer to share with others the notebook .
  3. Rich, interactive code generated output: HTML, image, video, LaTeX and custom MIME types.
  4. Using Python, R Scala, and other large data tools, such as Apache Spark. Use pandas, scikit-learn, ggplot2, TensorFlow explore the same data.
Official website: https://jupyter.org/

Experience: https://jupyter.org/try
blog link: https://www.iamzlt.com/?p=44

Installation conditions: Installation of Python (3.3 version and above, or version 2.7).

Installation is recommended to resolve the problem by installing Jupyter Notebook Anaconda, Anaconda has been automatically because Jupter Notebook and other tools installed for you, there are more than 180 scientific python package and its dependencies.

Anaconda installation:

Download https://www.anaconda.com/download/

After downloading Anaconda3-2019.07-Linux-x86_64.sh to the server, install the root user

#bash Anaconda3-2019.07-Linux-x86_64.sh

After installation increase environmental variables:

#vim /root/.bashrc //将以下内容加入文件中 
export PATH="/root/anaconda3/bin:$PATH"

After saving

#source /root/.bashrc

Validation results:

#conda list

Show Package name and version of the installed is the successful installation.

Jupyter Notebook Installation

After the installation is subjected Jupyter Notebook available Anaconda installation.

#conda install jupyter notebook

After a successful installation generates the configuration file:

#jupyter notebook --generate-config --allow-root

Before modifying the configuration file, first set about the password

Input: ipythonand enter from notebook.auth import passwdinputpasswd()

Get hash value of the password after password and confirm, copy and modify configuration files

Modify the configuration file:

#vim /root/.jupyter/jupyter_notebook_config.py

To remove the following comments and relevant changes

#c.NotebookApp.allow_root = False改成c.NotebookApp.allow_root =True

#c.NotebookApp.notebook_dir= ‘’改成自己想要存放文件的目录位置

#c.NotebookApp.ip=‘’改成#c.NotebookApp.ip=‘*’

#c.NotebookApp.password = ‘’ 改成设置密码获得的hash值

The firewall settings:

#firewall-cmd --zone=public --add-port=8888/tcp --permanent
success    
#systemctl restart firewalld.service
运行:

# jupyter notebook

// run the default port is 8888, if you run multiple jupyter notebook ports will be in ascending order, 8889,8890 ......

Visit url in your browser: ip: 8888 appears as shown below will be configured successfully.

Enter the password set (without entering a hash value), enter jupyter notebook, table of contents for the value of the configuration file c.NotebookApp.notebook_dir.

Click the new, the new file can be seen with a Python3

The use of relatively simple jupyter notebook, which has jupyter notebook Markdown code and edit mode, you can run the code and display the results. Below is a picture of my notes and learn Python code.

Of course in addition to Python, Jupyter Notebook also supports other forty kinds of programming languages, other languages ​​on the configuration of our next talk. If you have any questions, comments or private letter to me, given my best to answer.

Micro-channel public number:

Published 24 original articles · won praise 7 · views 1893

Guess you like

Origin blog.csdn.net/weixin_43426647/article/details/105328251