- 安装gcc编译器,如果存在就不需要安装了
yum -y install gcc
安装其他的依赖包:
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
- 安装wget,如果存在就不用安装
yum -y install wget
- 下载
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
- 解压
tar -zxvf Python-3.7.0.tgz
- 新建一个用于存放python的文件夹
mkdir /usr/local/python3
编译安装
cd Python-3.7.0 ./configure --prefix=/usr/local/python3 make && make install
建立软链接
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3 ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3
测试
输入python3
回车出现如下画面就成了
输入
exit()
即可退出。
Last modification:January 31, 2019
© Allow specification reprint