centos编译安装python3.6.4

随着云计算的兴起,python越来越流行.
为了方便学习,需要安装最新python3.6.4
下面是python编译安装的步骤

1安装依赖

yum install gcc make libffi-devel pkgconfig zlib-devel bzip2-devel sqlite-devel ncurses-devel expat-devel openssl-devel tk-devel gdbm-devel python-cffi xz-devel

2下载最新版的Python源代码并解压

wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
#解压缩
tar xzvf Python-3.6.4.tgz
#进入解压缩的Python源码目录
cd Python-3.6.4

3 编译并安装

#配置并开启优化(安装位置可自定义)
./configure --enable-optimizations  --prefix=/usr/bin/python3
#编译
make
#编译完之后安装
make install

4查看版本
python3 -V

Leave a Comment