【centos7.4安装python3.9环境】本次针对于centos系统和python3.9,其他版本操作相似
补充知识点:centos本身环境里是有python默认版本的,我这里是Python 2.7.5,同时Linux下源码的安装一般由3个步骤组成:配置(configure)、编译(make)、安装(make install),安装python开发环境也是这个步骤
1、yum安装依赖环境
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
2、python官网下载Python3.9.0 其他版本也是一样的
1.官网地址https://www.python.org/点击downloads
2.使用wget命令下载
yum -y install wget
wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz
3、创建安装目录
mkdir /usr/local/python3
tar -zxvf Python-3.9.0.tar
cdPython-3.9.0
./configure --prefix=/usr/local/python3
make && make install
4、创建软链接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
5、测试 输入python 进入python2
输入python3 进入python3的解释器