1、下载tar包

https://www.python.org/downloads/source/ image.png

2、解压编译安装

#当前版本
root@zabbix-server:~# python -V
Python 2.7.17

root@zabbix-server:~# tar xf Python-3.6.14.tgz
root@zabbix-server:~# cd Python-3.6.14/
root@zabbix-server:~/Python-3.6.14# ./configure --prefix=/usr/local/python3.6
root@zabbix-server:~/Python-3.6.14# make -j 2 && make install

3、修改默认Python版本

ln -s /usr/local/python3.6/bin/python3.6 /usr/bin/python3.6