安装依赖
- 安装gcc编译器
1 | yum -y install gcc |
- 安装其它依赖包
1 | yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel |
下载python3.7.3安装包
- 最新版本下载地址:https://www.python.org/downloads/
1 | # wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz |
安装python3.7.3
- 创建安装目录,例:
1 | # mkdir /usr/local/python3 |
- 解压下载的安装包
1 | # tar zxvf /Python-3.7.3.tgz . |
- 进入解压后的目录,编译安装
1 | # cd Python-3.7.3 |
建立软链接
1 | # ln -s /usr/local/python3/bin/python3 /usr/bin/python3 |
测试
1 | # python3 |