Linux下安装Python3.9.0详细步骤
Linux下安装Python3.9.0
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
使用wget下载python
yum -y install wget
wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz
根据个人喜好安装位置
mkdir -p /usr/local/python3.9
解压
tar -zxvf Python-3.9.0.tgz
进入解压目录后进行编译安装
./configure --prefix=/usr/local/python3.9
编译成功后进行编译安装
make && make install
检查python3.9的编译器
/usr/local/python3.9/bin/python3.9
配置环境变量
vi /etc/profile
在最下边输入
export PYTHON_HOME=/usr/local/python3.9
export PATH=${PYTHON_HOME}/bin:$PATH
使用配置的环境变量立即生效
source /etc/profile
注意
如果是上边安装目录没有指定,就不需要配置环境变量。因为Python3.9默认安装的目录/usr/local/bin是在环境变量中的。