CentOS7下简单安装python3.7.0步骤
程序员文章站
2022-12-24 08:52:07
一、安装编译工具 #yum -y install gcc #yum -y groupinstall "Development tools" #yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel ......
一、安装编译工具
#yum -y install gcc
#yum -y groupinstall "development tools"
#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
#yum -y install libffi-devel
二、下载python3
#wget https://www.python.org/ftp/python/3.7.0/python-3.7.0.tar.xz
#tar -jxvf python-3.7.0.tar.xz
注:tar.xz文件解压方法
#xz -d ***.tar.xz
#tar -xvf ***.tar
或者:
#tar jxvf ***tar.xz
三、编译安装
#mkdir /usr/local/python3 创建编译安装目录
#cd python-3.7.0
#./configure --prefix=/usr/local/python3
#make 编译
#make test 测试
#make install 编译安装
四、创建软链接
#mv /usr/bin/python /usr/bin/python.bak
#ln -s /root/python-3.7.0/python /usr/bin/python
最后测试
#python -v