System

CentOS 6.9

Installation dependency

#CentOS
yum install git gcc make patch gdbm-devel openssl-devel sqlite-devel readline-devel zlib-devel bzip2-devel -y

#Ubuntu
sudo apt update
sudo apt install make build-essential libssl-dev zlib1g-dev
sudo apt install libbz2-dev libreadline-dev libsqlite3-dev wget curl
sudo apt install llvm libncurses5-dev libncursesw5-dev

UserAdd

useradd python
passwd python
su python

Switch to the newly created user

Install pyenv

curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

Continue execution:

pyenv update

Configuring system variables:

vi .bashrc
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
source ~/.bashrc

Configure for pyenv

Install the new python and see the version that can be installed:

pyenv install --list

Continue execution:

pyenv install 3.5.3
mkdir py3
cd py3
pyenv local 3.5.3

The isolated installation package is in this directory:

/home/python/.pyenv/versions/3.5.3/lib/python3.5/site-packages

Create a virtual python environment

pyenv virtualenv 3.5.3 gz

Post-installation tips:

Requirement already satisfied: setuptools in /home/python/.pyenv/versions/3.5.3/envs/gz/lib/python3.5/site-packages
Requirement already satisfied: pip in /home/python/.pyenv/versions/3.5.3/envs/gz/lib/python3.5/site-packages

Continue execution:

pyenv versions

You can see the set information.

Continue execution:

pyenv local gz

Entering this directory, you enter the virtual environment.

Install ipython using pip

cd ~
mkdir .pip
cd .pip
vi pip.conf

Put the following content in the file.

[global]
index-url=https://mirrors.aliyun.com/pypi/simple/
trusted-host=mirrors.aliyun.com

Finish the created virtual directory and install ipython.

cd /home/python/py3
pip install ipython

Enter ipython to enter.

Install jupyter

pip install jupyter

Use jupyter notebook --help this command to view help,You need to set a password for jupyter.

jupyter notebook password gongzifu

Start jupyter

jupyter notebook --ip=0.0.0.0 --no-browser

Open jupyter in your browser:
http://IP:8888