Install python3 and pip3

Python

Ubuntu

Requirement

1
2
apt-get install build-essential
apt-get install zlib1g-dev (optional)

Install python2.7

1
2
3
4
apt-get update
apt-get install python
apt-get install python-pip
pip install --upgrade pip

Install python3+

1
2
3
apt-get install python3
apt-get install python3-pip
pip3 install --upgrade pip

Install python library - yaml

1
apt-get install python3-yaml

CentOS

Requirement

1
2
3
4
yum groupinstall 'Development Tools'
yum install zlib-devel
yum install zlib (optional)
yum install wget (optional)

Install python2.7

build-in python 2.7

Install python3.6

yum official repositories support up-to 3.4

1
yum install python34

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
curl -O https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
wget --no-check-certificate https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz (optional)
tar -xzvf Python-3.6.0.tgz
cd Python-3.6.0
./configure --prefix=/usr/local/python3
make
make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3


wget --no-check-certificate https://github.com/pypa/pip/archive/9.0.1.tar.gz
tar -zvxf 9.0.1.tar.gz
cd pip-9.0.1
python3 setup.py install
ln -s /usr/local/python3/bin/pip /usr/bin/pip3
pip install --upgrade pip

Install python plugin - pyyaml

Since pip only support HTTPS source

1
2
3
4
wget https://pypi.python.org/packages/4a/85/db5a2df477072b2902b0eb892feb37d88ac635d36245a72a6a69b23b383a/PyYAML-3.12.tar.gz#md5=4c129761b661d181ebf7ff4eb2d79950
tar -zxvf PyYAML-3.12.tar.gz
cd PyYAML-3.12/
python3 setup.py install