下载源文件

python.org 下载相应源代码

安装依赖环境

1
yum install bzip2-devel curses-devel dbm-devel gdbm-devel xz-devel sqlite sqlite-devel openssl openssl-devel tkinter tcl-devel tk-devel readline readline-devel zlib zlib-devel

一些其它库的名称

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
build-essential 
zlib1g-dev 
libbz2-dev 
libncurses5-dev 
libreadline6-dev 
libsqlite3-dev 
libssl-dev 
libgdbm-dev
liblzma-dev
tk8.5-dev

添加依赖库的 path

1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

程序编译安装

1
2
3
4
tar zxvf xxx.tar.gz
./configure --prefix=/usr/local/ # 其他可以通过 ./configure --help 查看
make -j <编译线程数>(不超过线程数的两倍)
make install