Linux下安装Python 3.6.1

  1. 准备编译环境
sudo yum groupinstall 'Development Tools'
sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel12

2.下载Python 3.6.1源码包

打开https://www.python.org/downloads/release/python-361/,下载XZ compressed source tarball

3.安装

3.1 创建安装文件的目录
sudo mkdir /usr/local/python3

3.2 进入到下载的目录解压缩
tar -Jxvf Python-3.6.1.tar.xz

3.3 配置
./configure --prefix=/usr/local/python3

3.4 编译
make

3.5安装
sudo make install

4.安装后已自动做软链,无需再进行操作

5.pip做软链
sudo ln -s /usr/local/python3/bin/pip3.6 /usr/bin/pip