Handy Python Code practice tool Jupyter-notebook installation and use

Source: Internet
Author: User
Tags install openssl openssl rehash git clone jupyter

Installation Environment:

Operating system: Centos7-x86-64minimal


I. installation pyenv

Pyenv is a python multi-version manager that enables multiple versions of Python to coexist on the system without affecting the python that comes with the system.

Install Git

Yum-y install git installs pyenv git clone git://github.com/yyuu/pyenv.git ~/.pyenv echo ' export pyenv_root= ' $HOME/.pyenv ' > > ~/.BASHRC echo ' Export path= ' $PYENV _root/bin: $PATH "' >> ~/.bashrc Echo ' eval ' $ (pyenv init-)" ' >> ~/.bas HRC EXEC $SHELL-L


Two. Install Python

To view the installable version

Pyenv Install--list

This command lists the Python versions that can be installed with pyenv


One of the shapes, such as x.x.x, is the official version of the Python version, and the other shapes, such as xxxxx-x.x.x, are either "derivative" or "release" after the same name and version.

Installing Python's dependencies requires installing Python with the other packages that it relies on first, and some known libraries that require pre-installation are as follows.

Yum-y Install ReadLine readline-devel readline-static yum-y install OpenSSL openssl-devel openssl-static yum-y Install Sqlite-devel yum-y Install Bzip2-devel bzip2-libs


Install the specified version

Use the following command to install Python 3.4.2:

Pyenv Install 3.4.2-v


The command downloads python's source code from GitHub, extracts it to the/tmp directory, and performs the compilation work in/tmp. If the dependent package is not installed, a compilation error occurs and the command needs to be re-executed after the dependent package is installed.

For the scientific research environment, it is recommended to install the Anaconda release which is specially prepared for scientific calculation, pyenv install anaconda-2.1.0 installs the 2.x version, pyenv install anaconda3-2.1.0 installs 3.x version;

Anacoda is very large, with pyenv download will be slow, you can go to the Anaconda official website to download, and the downloaded files in the ~/.pyenv/cache directory, then Pyenv will not be repeated download.

After the update database installation is complete, you need to update the database:

Pyenv Rehash


View the currently installed Python version

Pyenv versions System (set By/home/seisman/.pyenv/version)


The asterisk indicates that the python that is being used by the system is currently in use.

Set the global Python version

PYENV Global 3.4.2 Pyenv versions

The current global Python version has become 3.4.2. You can also use the pyenv local or pyenv shell to temporarily change the Python version.


Confirm Python version

Python-v


Using Python

Enter Python to use the new version of Python;

The system comes with a script that calls the old version of Python directly in a/usr/bin/python manner, and thus does not affect the system script;

Installing a third-party module with PIP is installed under ~/.pyenv/versions/3.4.2 and does not conflict with the system module.

After using PIP to install the module, you may need to perform pyenv rehash update the database;


Three. Installing Jupyter

1. Install the compilation tool gcc gcc-c++ patch

2. Installing PYZMQ

PYZMQ is a python binding for zeromq. ZEROMQ is a message kernel, from the point of view of network communication, it is in the session layer, under the application layer, with it, you do not even need to write a line of the socket function call can complete the complex network communication work.

3. Installing tornado

Tornado is a non-blocking server written by Python that uses Epoll to manage connections and handle thousands of connections per second, which is an ideal Web real-time processing framework.

4. Installing JINJA2

JINJA2 is the next widely used template engine in Python, and his design idea comes from the Django templating engine, which expands its syntax and a host of powerful features. One of the most notable of these is the addition of sandbox execution and optional auto-escape, which is important for the security of most applications.

5. Installing Jsonschema

Jasonschema is used to describe JSON data formats, and JSON schemas have many uses, one of which is instance authentication.

6. Installing Jupyter

As you can see from the previously installed components, Jupyter is actually a Tornado framework Web application that uses MQ for message management


Command:

Yum-y install gcc gcc-c++ patch pip3.4 install PYZMQ tornado JINJA2 Jsonschema jupyter


7. Refresh the database, or you cannot find the command

Pyenv Rehash


8. Add Jupyter to the service list

Vi/lib/systemd/system/jupyter.service

Modified to read as follows:

[Unit] description=juyperafter=network.target[service]tpye=forkingenvironmentfile=/root/.pyenv/shims/ Jupyter-notebookexecstart=/root/.pyenv/shims/jupyter-notebook--ip=*execstop=/usr/bin/pkill notebookKillMode= Processrestart=on-failurerestartsec=42s[install]wantedby=multi-user.target



Set boot up

Systemctl Enable Juyper.service


Start Juyper

Systemctl Start Juyper.service

View the current status of the Juyper service

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7D/C1/wKioL1bvlbLz8TyxAAB2jl900lI205.png "title=" Image.png "alt=" Wkiol1bvlblz8tyxaab2jl900li205.png "/>


Four. Using Juyper-notebook

Turn off the firewall Systemctl stop firewalld.service the SELinux setenforce 0


650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7D/C1/wKioL1bvllTAejkkAACIaGnNwDA012.png "title=" Image.png "alt=" Wkiol1bvlltaejkkaaciagnnwda012.png "/>


The magical Practice begins

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7D/C1/wKioL1bvlpXx97BdAACLfW4ciqQ823.png "title=" Image.png "alt=" Wkiol1bvlpxx97bdaaclfw4ciqq823.png "/>

This article is from the "left-handed" blog, make sure to keep this source http://mofeihu.blog.51cto.com/1825994/1753447

Handy Python Code practice tool Jupyter-notebook installation and use

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.