1.先安装一些我遇到的依赖问题(如果有依赖问题按提示安装):
yum install xz gcczlib zlib-devel
2.官网下载源码包
地址:https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
3.解压文件
xz -dPython-3.6.1.tar.xz
tar -xvfPython-3.6.1.tar
4.进入文件目录
cdPython-3.6.1
5.开始安装编译
1
2
3
|
.
/
configure
-
-
prefix
=
usr
python3.
6
make
make install
|
6.让centos7 系统默认使用python3.6
cd
/
bin
/
mv python python.bak
ln
s
6
python3
python
ln
-
s
/
usr
python3.
6
/
bin
python3
python3
ln -s /usr/python3.6/bin/pip3 /usr/bin/pip
ln -s /usr/python3.6/bin/pip3 /usr/bin/pip3
3
4
5
ex
bin
]
# python
Python
3.6
.
1
(default,May
25
2017
,
20
:
35
)
[GCC
4.8
5
20150623
(Red Hat
5
-
11
)] on linux
Type
"help"
"copyright"
"credits"
or
"license"
for
more information.
>>>